spuy767 Posted August 6, 2007 Share Posted August 6, 2007 I have been trying this for two days now, I just want to run imagecopy to get part of two different images into an image for display. At any rate, I can get the image to show up if I save it and open it in photoshop, but I can never get it to render in a browser. Here, is some relatively ugly code using imagecopymerge() that I tried the last time I did it. It always shows an empty image box, but if get the image properties, it gives me a size of 0 x 0, a bpp of 0, but the filesize is spot on. <?php $background = imagecreatefrompng("http://www.tennis-schedule.com/images/visix/Red-Blue_Logo_Three.png"); $foreground = imagecreatefrompng("http://www.tennis-schedule.com/images/visix/Marriott-Background.png"); imagecopymerge($background, $foreground, 0, 0, 0, 0, 256, 256, 60); header('Content-type: image/png'); imagepng($background); imagedestroy($background); imagedestroy($foreground); ?> Edit: Almost forgot, the server is running 4.3.11, with GD 2.0.28 Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/ Share on other sites More sharing options...
cooldude832 Posted August 6, 2007 Share Posted August 6, 2007 you need some headers saying what kinda image it is such as <?php header("Content-type: image/jpeg"); ?> for a jpeg or png for png etc etc Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/#findComment-316448 Share on other sites More sharing options...
spuy767 Posted August 6, 2007 Author Share Posted August 6, 2007 header('Content-type: image/png'); Thanks for the tip. Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/#findComment-316458 Share on other sites More sharing options...
cooldude832 Posted August 6, 2007 Share Posted August 6, 2007 didn't see it buried because its below everything, try forcing it to the top, if you are supressing errors it might not realize the errror and this sounds like a classic header error. Also you might need to look into imagecreate() Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/#findComment-316459 Share on other sites More sharing options...
spuy767 Posted August 6, 2007 Author Share Posted August 6, 2007 didn't see it buried because its below everything, try forcing it to the top, if you are supressing errors it might not realize the errror and this sounds like a classic header error. I've tried it about everywhere, but I'll put it at the top. Nope. . . Still broke. I always put my header info right before the stream, it's worked on other servers. Evne running similar configs and versions. Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/#findComment-316460 Share on other sites More sharing options...
cooldude832 Posted August 6, 2007 Share Posted August 6, 2007 hmm tough luck, only idea I can think of is not a good one, that be to save the created image and then reopen it in the same doc then delete given image at footer of doc Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/#findComment-316462 Share on other sites More sharing options...
Barand Posted August 6, 2007 Share Posted August 6, 2007 Hmm, your code as posted worked fine for me ??? Image size 1280 x 720 with a 256 x 256 semi-transparent pink and white image in top left Are you placing on page with <img src='myimage.php' > (where myimage.php is the above script) Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/#findComment-316546 Share on other sites More sharing options...
spuy767 Posted August 7, 2007 Author Share Posted August 7, 2007 I have fixed my problem. I just installed a real web server, Apache, where I was trying to run PHP on IIS. Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/#findComment-317484 Share on other sites More sharing options...
Barand Posted August 7, 2007 Share Posted August 7, 2007 FYI - I was running XP/IIS Quote Link to comment https://forums.phpfreaks.com/topic/63487-solved-image-never-renders/#findComment-317721 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.