【发布时间】:2022-01-11 22:36:52
【问题描述】:
我创建了一个脚本,我使用 PHP GD 库将图像放置在另一个图像的中心。之后,我在该中心放置的图像上方放置了一个 PNG 框架。
我现在想为该图像赋予 3D 效果,或者边缘周围的一些阴影对我有用。我该怎么做?
// Get Product Image sizes
list($width, $height) = getimagesize($filename);
// Load
$source = imagecreatefromjpeg($filename);
// Output
if(isset($frame_image) && !empty($frame_image))
{
$png = imagecreatefrompng($frame_image);
list($newwidthf, $newheightf) = getimagesize($frame_image);
$out = imagecreatetruecolor($width, $height);
imagecopyresampled($out, $source, 0, 0, 0, 0, $width, $height, $width, $height);
imagecopyresampled($out, $png,0, 0, 0, 0, $width, $height, $newwidthf, $newheightf);
$final = imagejpeg($out);
}
else
{
$final = imagejpeg($source);
}
这是我生成的图像:
【问题讨论】: