【发布时间】:2012-07-27 04:56:42
【问题描述】:
我有这个功能,当我传递一个小于我想要创建的裁剪的图像时,它会生成更大尺寸的图像,没关系,但其余没有图像的地方,它用黑色填充,你知道如何通过使用 f.e. 来强制它创建白色或特定颜色吗?数组(255,255,255)??
这是它为你创建的图片,让你直接看到我的意思。
public function crop($x, $y, $width, $height)
{
$copy=imagecreatetruecolor($width,$height);
//$this->img = imagecolorallocate($this->img, 23, 123, 456);
if (imagecopy($copy, $this->img, 0, 0, $x, $y, $width, $height)) {
$this->img=$copy;
return true;
}
return false;
}
【问题讨论】:
标签: php