golles Posted September 5, 2007 Share Posted September 5, 2007 First of all, I don't know if this is possible, hope so. I have edited an image with PHP, put some text on multiple places with the following code <?php $imgtext = "TEST"; $im = imagecreatefromjpeg("myimg.jpg"); $textcolor = imagecolorallocate($im, 0, 0, 0); $font = 4; imagestring($im, $font, 180, 270, "$imgtext", $textcolor); header("Content-type: image/jpg"); imagepng($im); imagedestroy($im) ?> what I want next is to put some other images (multiple) into this one (myimg.jpg). hope you do understand what I want and hope you can tell me that it is posible and how I can do it. many many thank //golles PS. it is just for a fun project from me and a mate Quote Link to comment https://forums.phpfreaks.com/topic/68051-solved-php-put-an-image-into-another/ Share on other sites More sharing options...
golles Posted September 6, 2007 Author Share Posted September 6, 2007 is there no one who can help me? Quote Link to comment https://forums.phpfreaks.com/topic/68051-solved-php-put-an-image-into-another/#findComment-343029 Share on other sites More sharing options...
Barand Posted September 6, 2007 Share Posted September 6, 2007 use imagecopy(), or imagecopymerge() if you want to vary the transparency Quote Link to comment https://forums.phpfreaks.com/topic/68051-solved-php-put-an-image-into-another/#findComment-343061 Share on other sites More sharing options...
golles Posted September 7, 2007 Author Share Posted September 7, 2007 use imagecopy(), or imagecopymerge() if you want to vary the transparency I have tried imagecopy() but it aint working probably I'm doing something wrong, but I can't see what I'm doing wrong Warning: imagecopy(): supplied argument is not a valid Image resource in C:\...\test.php on line 11 Warning: Cannot modify header information - headers already sent by (output started at C:\...\test.php:11) in C:\...\test.php on line 13 this is the code I'm using: <?php $imgtext = "TEST"; $groen = "groen.jpg"; $im = imagecreatefromjpeg("myimg.jpg"); $textcolor = imagecolorallocate($im, 0, 0, 0); $font = 4; imagestring($im, $font, 180, 270, "$imgtext", $textcolor); imagecopy($im, $groen, 50, 400, 0, 0, 51, 57); header("Content-type: image/jpg"); imagepng($im); imagedestroy($im) ?> hope you can help me with this. thanks in advance //golles Quote Link to comment https://forums.phpfreaks.com/topic/68051-solved-php-put-an-image-into-another/#findComment-343781 Share on other sites More sharing options...
Barand Posted September 7, 2007 Share Posted September 7, 2007 $groen also needs to be a gd image $groen = imagecreatefromjpeg("groen.jpg"); $im = imagecreatefromjpeg("myimg.jpg"); Quote Link to comment https://forums.phpfreaks.com/topic/68051-solved-php-put-an-image-into-another/#findComment-343785 Share on other sites More sharing options...
golles Posted September 7, 2007 Author Share Posted September 7, 2007 ah damn, I tried that earlier... really really stupid, the destination image was smaller then 400. anyway Barend thank you and sorry for my stupidness! //golles Quote Link to comment https://forums.phpfreaks.com/topic/68051-solved-php-put-an-image-into-another/#findComment-343798 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.