使用干预图像裁剪小文件填充

时间:2015-04-12 13:27:03

标签: php image crop

有办法用干涉图像填充透明的黑色区域吗?

 $data = file_get_contents("php://input"); 

    $img = Image::make($data);

    $path = sprintf("%/data/%s/img",public_path(),Auth::user()->account_id);

    @mkdir($path,0775,true);

    $img->crop(350, 150)->encode('png', 90)->save(sprintf("%s/logo.png",$path));

Original

Croped image

1 个答案:

答案 0 :(得分:1)

解决修剪方法!

解决方案:

$img->crop(350, 150)->encode('png', 90)->trim()->save(sprintf("%s/logo.png",$path));