ch4rli3 Posted August 15, 2012 Share Posted August 15, 2012 Hi guys, i have trouble with my imagecolortransparent from gd library. On one server everything works fine, but if i moved it to hosting server it not works. here's code: <?php $width = 0; $height = 0; list($width, $height, $type, $attr) = getimagesize('img/design/GA_preview.png'); if(!$image=imagecreatefrompng('img/design/GA_preview.png')){ echo "Error while loading image"; exit; } $color_1 = imagecolorat($image, 50,50); $result = imagecolortransparent($image,$color_1); if(!$bg=imagecreatefrompng('img/material/B1_E475_preview.png')){ echo "Error while loading image"; exit; } imagecopy($bg, $image, 0,0,0,0,$width, $height); Header("Pragma: No-cache"); Header("Cache-Control: No-cache, Must-revalidate"); Header("Expires: ".GMDate("D, d M Y H:i:s")." GMT"); header("Content-type: image/jpeg"); imagejpeg($bg, "", 100); imagedestroy($image); imagedestroy($bg); ?> this is how it should look: http://212.111.5.196:8088/graspo/diar_vyvoj/test.php and this is how it looks: firemnidiar.graspo.com/diar/test.php for better solving of my problems here are phpinfo files on both servers: working: http://212.111.5.196:8088/graspo/diar_vyvoj/info.php not working: firemnidiar.graspo.com/diar/phpinfo.php Quote Link to comment https://forums.phpfreaks.com/topic/267103-imagecolortransparent-trouble/ Share on other sites More sharing options...
MMDE Posted August 15, 2012 Share Posted August 15, 2012 This is a wild guess, because I can't see anything else that is wrong if it works on your server with the exact same code, but are you sure the script are able to get to get the images using the function imagecreatefrompng()? Quote Link to comment https://forums.phpfreaks.com/topic/267103-imagecolortransparent-trouble/#findComment-1369541 Share on other sites More sharing options...
ch4rli3 Posted August 15, 2012 Author Share Posted August 15, 2012 Yes i'm sure, because i try to draw on top $bg and $image...both was drawn Quote Link to comment https://forums.phpfreaks.com/topic/267103-imagecolortransparent-trouble/#findComment-1369543 Share on other sites More sharing options...
kicken Posted August 15, 2012 Share Posted August 15, 2012 Try using imagecopymerge instead of imagecopy. It should have the effect your after. As for why it works on one server but not the other, I don't know. One of them is compiled with the bundled GD library while the other appears to use the system library. There must be some small difference between the two that is causing the different output Quote Link to comment https://forums.phpfreaks.com/topic/267103-imagecolortransparent-trouble/#findComment-1369552 Share on other sites More sharing options...
ch4rli3 Posted August 15, 2012 Author Share Posted August 15, 2012 imagecopymerge not works too....everything directing to troubles with transparency, but i dont know, where to look for that what change in configuration of php Quote Link to comment https://forums.phpfreaks.com/topic/267103-imagecolortransparent-trouble/#findComment-1369554 Share on other sites More sharing options...
MMDE Posted August 15, 2012 Share Posted August 15, 2012 Might be helpful, might be just a waste of time, but maybe if you create the image first... imagecreastetruecolor() and then copy it over. Might also be you must use one of these: imagesavealpha() imagealphablending() Quote Link to comment https://forums.phpfreaks.com/topic/267103-imagecolortransparent-trouble/#findComment-1369589 Share on other sites More sharing options...
ch4rli3 Posted August 16, 2012 Author Share Posted August 16, 2012 Unfortunately not works any other ideas? i googled for 6 hours and i dont found nothing Quote Link to comment https://forums.phpfreaks.com/topic/267103-imagecolortransparent-trouble/#findComment-1369827 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.