algarve4me Posted March 25, 2007 Share Posted March 25, 2007 I have been experimenting with php GD Graphics. I have managed to create a new jpeg image and insert dynamic text from a mysql database into the image. I have now come up against a problem and I have been unable to find an answer on the internet. Is it possible to create a new jpeg php gd image and then insert an existing jpeg photo into that image? Link to comment https://forums.phpfreaks.com/topic/44221-is-it-possible-to-include-a-photo-inside-a-php-gd-graphic-image/ Share on other sites More sharing options...
AndyB Posted March 25, 2007 Share Posted March 25, 2007 http://ca.php.net/manual/en/function.imagecopymerge.php Link to comment https://forums.phpfreaks.com/topic/44221-is-it-possible-to-include-a-photo-inside-a-php-gd-graphic-image/#findComment-214775 Share on other sites More sharing options...
algarve4me Posted March 25, 2007 Author Share Posted March 25, 2007 AndyB Thank you for that reference. I wasn't aware that I could use that php function to include a photo into a GD graphic image. The php.net page gives some interesting examples. I have now managed to include a photo inside one which I created using GD Graphics. I have used a function provided by Stefan on the php.net page. However, I now have to figure out how to insert a photo that is not stored in the same directory as the php file. Link to comment https://forums.phpfreaks.com/topic/44221-is-it-possible-to-include-a-photo-inside-a-php-gd-graphic-image/#findComment-214804 Share on other sites More sharing options...
algarve4me Posted March 26, 2007 Author Share Posted March 26, 2007 I have another problem. I have been able to create a jpeg image with "imagecreate" and then add the jpeg photo using ("imagecreatefromjpeg" and "imagecopymerge") by doing this using two separate scripts. This works ok. However, when I try to combine both scripts into one function which creates a new image and then merges the photo into it, the photo loses a lot of the colors. Is there an easy way to get round this problem? Link to comment https://forums.phpfreaks.com/topic/44221-is-it-possible-to-include-a-photo-inside-a-php-gd-graphic-image/#findComment-215252 Share on other sites More sharing options...
algarve4me Posted March 26, 2007 Author Share Posted March 26, 2007 Ok, I just had a brainwave and I think that I have solved my problem. Instead of putting both scripts into one function, I created the new jpeg image using php code and I then followed that with a function which inserted the photo into the newly created image. Link to comment https://forums.phpfreaks.com/topic/44221-is-it-possible-to-include-a-photo-inside-a-php-gd-graphic-image/#findComment-215265 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.