1

I have created a script where I am placing an image in the center of another image using the PHP GD library. After that I've placed a PNG frame above that center placed image.

I now want to a give that image a 3D effect, or some shadow around the edges will work for me. How can I do that ?

// 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);
}

Here is the image which I have generated:

enter image description here

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • Does this answer your question? [How can I add a drop-shadow to an image using PHP?](https://stackoverflow.com/questions/7288173/how-can-i-add-a-drop-shadow-to-an-image-using-php) – Andrea Olivato Jun 08 '21 at 14:20

1 Answers1

0

I'm using imagescale and a shadow background, work

LuigiMdg
  • 37
  • 3
  • 13