cooldude832 Posted September 24, 2009 Share Posted September 24, 2009 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); ?> Link to comment https://forums.phpfreaks.com/topic/175315-png-resize-black-box-but-works-on-jpeggif/ Share on other sites More sharing options...
cooldude832 Posted September 24, 2009 Author Share Posted September 24, 2009 It is only failing on oversized pngs any ideas? Link to comment https://forums.phpfreaks.com/topic/175315-png-resize-black-box-but-works-on-jpeggif/#findComment-923939 Share on other sites More sharing options...
thehippy Posted September 28, 2009 Share Posted September 28, 2009 Was PNG support built into the extension? There's a note in the imagecopyresampled() about images with large palette sizes (255+1) in which you may want to use imagecreatetruecolor() in that instance. Link to comment https://forums.phpfreaks.com/topic/175315-png-resize-black-box-but-works-on-jpeggif/#findComment-926209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.