您现在的位置是:首页> 编程文章 个人博客模板

laravel 安装 使用 intervention/image

无痕小Q个人博客 2021-11-17 10:44:48【 主页】 1819人已围观

简介composer require intervention/image

1;安装

composer require intervention/image

2:生成 config/image.php 配置文件:

php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"

3:使用

文档http://image.intervention.io/api/text

4:demo

use Intervention\Image\ImageManagerStatic as Image;
// 绘制模版1 y图
$data_y = Image::make($img_y);
$data_y->resize($y_w, 1080, function($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
});

$data_y->text($request->name, $y_w/2, 350+$y_h,function ($font) use ($fontPath) {
$font->file($fontPath);
$font->size(120);
$font->color('#fdf6e3');
$font->align('center');
$font->valign('top');
});

$data_y->text($request->title, $y_w/2, 510+$y_h,function ($font) use ($fontPath) {
$font->file($fontPath);
$font->size(33.6);
$font->color('#fdf6e3');
$font->align('center');
$font->valign('top');
});
$data_y->text('会议时间: '.$request->begin_at, $y_w/2, 648+$y_h,function ($font) use ($fontPath) {
$font->file($fontPath);
$font->size(28.18);
$font->color('#fdf6e3');
$font->align('center');
$font->valign('top');
});
$data_y->text('会议地点: '.$request->place, $y_w/2, 685+$y_h,function ($font) use ($fontPath) {
$font->file($fontPath);
$font->size(28.18);
$font->color('#fdf6e3');
$font->align('center');
$font->valign('top');
})
->save($path_y,80,'jpg');


5:效果









阅读量! (1819)

关于本站

昵称:无痕小Q

职业:php-go-web开发工程师

现居:北京

Email:1838638884@qq.com

    甫昔少年日,早充观国宾。  读书破万卷,下笔如有神。

网站公告

  • 欢迎来到我的博客

  • 1:欢迎来到我的博客


    2:博客免费api接口现已上线


    3:博客会定期更新文章


    4:欢迎大家来捧场


    山花烂漫, 你是昨夜晓凤.

站点信息

明月黯淡, 你是最后曙光. 两个黄鹂鸣翠柳,一行白露上青天。 窗含西岭千秋雪,门泊东吴万里船。
  • 建站时间:2019-8-30
  • 网站程序:php,laravel-swoole框架
  • 今日流量:530(10分钟统计一次)
  • 本月流量:20210
  • 浏览总量:657071
  • 统计方式:中间件,redis消息队列,定时任务
    生活的道路一旦选定,就要勇敢地走到底,决不回头。