Letterbomb05 Posted March 16, 2009 Share Posted March 16, 2009 Hi, I'm currently messing around with using PHP to use dynamic sigs for forums and such, however I've come across a bit of a problem using one of my images. <?php header('Content-type: image/png'); class sig { public function sig() { $image = imagecreatefrompng("sigs/blue_proto.png");; imagepng($image); imagedestroy($image); } } new sig; ?> Here is the image I am trying to use: And here is what happens when I use it in PHP: As you can see, for some reason the left size of my image gets cut off, and the transparency at the bottom seems to fail. This is my first time working with images in PHP, sorry if there is an obvious solution Thanks, Letterbomb05. Quote Link to comment https://forums.phpfreaks.com/topic/149676-solved-php-png-image-problem/ Share on other sites More sharing options...
Letterbomb05 Posted March 16, 2009 Author Share Posted March 16, 2009 bump? Quote Link to comment https://forums.phpfreaks.com/topic/149676-solved-php-png-image-problem/#findComment-786162 Share on other sites More sharing options...
AV1611 Posted March 16, 2009 Share Posted March 16, 2009 I've only done a little with GD, but I can say that I think PNG is opened as indexed, so the transparency won't work. without doing other stuff... Try: <?php function LoadPng($imgname); { $im=@imagecreatefrompng($imgname); return $im; } header("Content-Type: image/png"); $img=LoadPng("sigs/blue_proto.png"); imagepng($img); ?> Quote Link to comment https://forums.phpfreaks.com/topic/149676-solved-php-png-image-problem/#findComment-786190 Share on other sites More sharing options...
xylex Posted March 16, 2009 Share Posted March 16, 2009 The first comment http://us.php.net/imagecreatefrompng Quote Link to comment https://forums.phpfreaks.com/topic/149676-solved-php-png-image-problem/#findComment-786197 Share on other sites More sharing options...
Letterbomb05 Posted March 16, 2009 Author Share Posted March 16, 2009 Thanks for both your help, got it sorted Quote Link to comment https://forums.phpfreaks.com/topic/149676-solved-php-png-image-problem/#findComment-786205 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.