Jump to content

[SOLVED] PHP PNG image problem...


Letterbomb05

Recommended Posts

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:blue_proto.png

 

And here is what happens when I use it in PHP:

problem.jpg

 

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 :P

 

Thanks,

Letterbomb05.

 

Link to comment
https://forums.phpfreaks.com/topic/149676-solved-php-png-image-problem/
Share on other sites

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);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.