Solar Posted April 7, 2009 Share Posted April 7, 2009 I have a script to import text from a form and insert into a picture. Is it possible to import an image ontop of an image? <?php header("Content-type: image/png"); $user = $_POST['user']; $user = $_GET['user']; $im = imagecreatefrompng("banner.png"); $user_width = imagettfbbox(50, 50, "verdana.ttf", $user); $x_value = (122 - ($user_width[10] + 122)); $color = imagecolorallocate($im, 255, 255, 255); imagettftext($im, 20, 0, $x_value, 65, $color, "verdana.ttf", $user); imagepng($im); imagedestroy($im); ?> What would I go by? Quote Link to comment https://forums.phpfreaks.com/topic/152939-solved-is-it-possible/ Share on other sites More sharing options...
MasterACE14 Posted April 7, 2009 Share Posted April 7, 2009 image on top of an image as in HTML and CSS layers? or image within a image with PHP? Quote Link to comment https://forums.phpfreaks.com/topic/152939-solved-is-it-possible/#findComment-803205 Share on other sites More sharing options...
Axeia Posted April 7, 2009 Share Posted April 7, 2009 Going by the code he posted it's an image created by GD. Yes it's possible, but your host needs to have GD support enabled, you could create a phpinfo file and check the output to see if it does. Problem with images is that you don't see much when it errors out, try commenting the "header("Content-type: image/png");" line. That should make errors show up unless your host has disabled error reporting together. I'm guessing if GD is installed/enabled that your problem lies either with the $user getting called for twice where the $_POST is getting absoleted by the $_GET or due to verdana.ttf not being installed on the server. You may want the look up $_REQUEST if you want to use $_POST whenever $_GET isn't set. PS: Use code tags instead of blockquote for syntax highlighting. Quote Link to comment https://forums.phpfreaks.com/topic/152939-solved-is-it-possible/#findComment-803211 Share on other sites More sharing options...
Yesideez Posted April 7, 2009 Share Posted April 7, 2009 Even with error codes disabled they can be enabled. error_reporting(E_ALL ^ E_NOTICE); That will show all errors but not the notices. In order to display the error messages when playing with GD functions comment out the line(s) sending the image header info (as mentioned above) and access the file using the GD functions directly in the browser as calling it from IMG will still hide the errors. Quote Link to comment https://forums.phpfreaks.com/topic/152939-solved-is-it-possible/#findComment-803213 Share on other sites More sharing options...
Solar Posted April 7, 2009 Author Share Posted April 7, 2009 The code I posted works absolutly great, no errors, no nothing. I was just seeing if there were anything I could go by to make an image within an image. Quote Link to comment https://forums.phpfreaks.com/topic/152939-solved-is-it-possible/#findComment-803595 Share on other sites More sharing options...
Axeia Posted April 7, 2009 Share Posted April 7, 2009 Ah okay, wasn't clear to me. Yes you can, have a read over at the PHP GD2 documentation . Most likely you'll want to use imagecopymerge, and don't forget to read the comments there. They often have nice examples of people trying to do the same thing. Quote Link to comment https://forums.phpfreaks.com/topic/152939-solved-is-it-possible/#findComment-803601 Share on other sites More sharing options...
Solar Posted April 7, 2009 Author Share Posted April 7, 2009 Thankyou very much, you've been a great help! Quote Link to comment https://forums.phpfreaks.com/topic/152939-solved-is-it-possible/#findComment-803733 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.