Jump to content

Archived

This topic is now archived and is closed to further replies.

sujeetji

How To Set Image As Background of Image in GD Library

Recommended Posts

Hi All
I want to set an imge(.jpeg/.gif) as the background of
my own created image through the GD library.
[b]let me explain[/b]:
i have an [b]example.jpeg[/b] image and through the GD library i am greating an rectangle and i want to set [b]example.jpeg as the background of this rectangle[/b].
please help me.

Thankx
[i][b]Sujeet[/b][/i]
sujeet.kumar@ecotechservices.com

Share this post


Link to post
Share on other sites
hi
nothing special here - create your canvas using 'imagecreatefromjpeg' or 'imagecreatefromgif' instead of 'imagecreate' or 'imagecreatetruecolor'. then you just lay down whatever you want just as normal. for example:

[code]
$im = imagecreatefromjpeg("myfile.jpg");

$red = imagecolorallocate($im, 255,0,0);
imagerectangle($im, 20,20,120,120, $red);

...etc...
...etc...
[/code]

hope that helps
Cheers
Mark

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.