Jump to content

PNG resize = black box but works on jpeg/gif?


cooldude832

Recommended Posts

using this block (modify the png functions for jpeg/gif) works fine on jpg/gif no good on pngs gives a oversized black box

<?php
					$image_p = imagecreatetruecolor($width,$height);
					$im = imagecreatefrompng("uploads/".$tmp_name);
					imagecopyresampled($image_p, $im, 0, 0, 0, 0, $i_dat[0],$i_dat[1], $width, $height);
					$ipath = "images/icons/users/".$imgid.".png";
					$fp = fopen($ipath,"x");
					fclose($fp);
					imagepng($image_p,$ipath);
					unlink($tmp_pos);
					$q = "Update `".IMAGES_TABLE."` Set Ext = 'png' Where ImageID = '".input_clean($imgid)."' LIMIT 1";
					$r = mysql_query($q) or die(mysql_error()."<br /><br />".$q);
?>

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.