Jump to content

Recommended Posts

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 :P

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

 

Link to comment
https://forums.phpfreaks.com/topic/68051-solved-php-put-an-image-into-another/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.