Menu

php图片添加水印,做海报,添加文字等处理的composer包推荐

发布时间:2019-11-06 11:24:41作者:柯曾栎 韩宇热度: 547 ℃

包名:

Intervention Image


使用前请确保服务器安装了imagemagick




宝塔面板如上

其他服务器自行百度命令行进行安装 - 谢谢



安装及下载:

composer require intervention/image


官网地址:http://image.intervention.io/

单独使用demo:


<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/11/6
 * Time: 9:13
 */

require 'vendor/autoload.php';


// import the Intervention Image Manager Class
use Intervention\Image\ImageManagerStatic as Image;

// configure with favored image driver (gd by default)
Image::configure(array('driver' => 'imagick'));

// open an image file
//$image = Image::make('assets/images/3.jpg')->resize(300, 200);
$img =Image::make('assets/images/3.jpg');


// resize image instance
$img->resize(320, 240);

// insert a watermark
$img->insert('assets/images/watermark.png');

// save image in desired format
$img->save('bar.jpg');


使用请保证您的图片路径正确及图片可读

米醋儿 micuer.com