问题描述
如果裁剪框比原始图像大,看起来我会得到黑色背景。是否有任何解决方案可以使新图像的透明度变大,即使它更大?
谢谢
private function crop($src,$dst,$data)
{
if (!empty($src) && !empty($dst) && !empty($data)) {
switch ($this->type) {
case IMAGETYPE_GIF:
$src_img = imagecreatefromgif($src);
break;
case IMAGETYPE_JPEG:
$src_img = imagecreatefromjpeg($src);
break;
case IMAGETYPE_PNG:
$src_img = imagecreatefrompng($src);
break;
}
[...]
$dst_img = imagecreatetruecolor($dst_img_w,$dst_img_h);
// Add transparent background to destination image
imagefill($dst_img,imagecolorallocatealpha($dst_img,127));
imagesavealpha($dst_img,true);
$result = imagecopyresampled($dst_img,$src_img,$dst_x,$dst_y,$src_x,$src_y,$dst_w,$dst_h,$src_w,$src_h);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)