Patriot Posted March 9, 2008 Share Posted March 9, 2008 The gift on the right side is dynamically placed on the background using image copy. Before the copy, the image of the gift looks fine. Now it loses color and turns pinkish. CODE: $banner = imagecreatefromgif("tbg1.gif"); $prizeimage = imagecreatefromgif("tgt1.gif"); $fontcolor = imagecolorallocate($banner, 0, 0, 0); imagettftext($banner, 13, 0, 7, 74, $fontcolor, "myriadregpro.otf", "Stuff: " . $prize); imagecopyresampled($banner, $prizeimage, 312, 4, 0, 0, 84, 97, 84, 97); Does anyone know what is wrong? Quote Link to comment https://forums.phpfreaks.com/topic/95286-imagecopy-color-and-resolution-loss/ Share on other sites More sharing options...
BlueSkyIS Posted March 9, 2008 Share Posted March 9, 2008 howdy, i lost the previous thread on this. can you provide both original images and i'll take a shot at getting one on the other without losing color/resolution/etc.? if you can just post a link to both originals or whatever, i'll hack the code together here and (hopefully) figure out the problem. Quote Link to comment https://forums.phpfreaks.com/topic/95286-imagecopy-color-and-resolution-loss/#findComment-488023 Share on other sites More sharing options...
Patriot Posted March 9, 2008 Author Share Posted March 9, 2008 Here you go: Thanks! Gil Quote Link to comment https://forums.phpfreaks.com/topic/95286-imagecopy-color-and-resolution-loss/#findComment-488024 Share on other sites More sharing options...
BlueSkyIS Posted March 9, 2008 Share Posted March 9, 2008 okay, i'm on it. Quote Link to comment https://forums.phpfreaks.com/topic/95286-imagecopy-color-and-resolution-loss/#findComment-488027 Share on other sites More sharing options...
BlueSkyIS Posted March 9, 2008 Share Posted March 9, 2008 see if this works for you. i don't have the font, so i left it out. shouldn't make a difference, but you should un-comment it for testing. <?php $complete_img = imagecreatetruecolor(400,105); $banner = imagecreatefromgif("tbg1.gif"); $prizeimage = imagecreatefromgif("tgt1.gif"); //$fontcolor = imagecolorallocate($complete_img, 0, 0, 0); //imagettftext($complete_img, 13, 0, 7, 74, $fontcolor, "myriadregpro.otf", "Stuff: " . $prize); imagecopy($complete_img, $banner, 0, 0, 0, 0, 400, 105); imagecopy($complete_img, $prizeimage, 312, 4, 0, 0, 84, 97); header('Content-type: image/jpeg'); imagejpeg($complete_img, null, 100); // Finished image is $complete_img ?> Quote Link to comment https://forums.phpfreaks.com/topic/95286-imagecopy-color-and-resolution-loss/#findComment-488033 Share on other sites More sharing options...
BlueSkyIS Posted March 9, 2008 Share Posted March 9, 2008 by the way, here is what i got: Quote Link to comment https://forums.phpfreaks.com/topic/95286-imagecopy-color-and-resolution-loss/#findComment-488039 Share on other sites More sharing options...
Patriot Posted March 9, 2008 Author Share Posted March 9, 2008 Haha it worked like a charm. THANK YOU SOOO MUCH! Quote Link to comment https://forums.phpfreaks.com/topic/95286-imagecopy-color-and-resolution-loss/#findComment-488042 Share on other sites More sharing options...
BlueSkyIS Posted March 9, 2008 Share Posted March 9, 2008 very good. no problem! Quote Link to comment https://forums.phpfreaks.com/topic/95286-imagecopy-color-and-resolution-loss/#findComment-488047 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.