Ash, Martin, Seems you are both wandering around the obvious problem... I suspect that $tipo (in the next line) is *supposed* to be $type - sounds like a partial Italian translation to me... So given that $type="imagecreatefrompng" (for example, if the mime check returns 'png' - not very reliable, I suspect), then $immagine = $type($this->updir.$id.'.png') should create a GD resource from the file, but the image appears to be empty. My take on this is: OP says he gets the same result from $immagine = imagecreatefromjpeg(this->updir.$id.'.png') - well I might expect to get an error message if I loaded a PNG expecting it to be a JPEG, but I certainly wouldn't expect an image. On some basic tests, I find that mime_content_type() is not defined on my system, so ignoring that and trying to load a PNG file using imagecreatefromjpeg results in pretty much the same result as the OP... Conclusions: First: if you use Italian for your variable names, don't change half of their instances to English... Second: Make sure you actually know the mime type of a file before you try to load it into GD... My version of this would test against known image types to try the GD function: foreach (Array('png','jpeg','gif') as $typeName) { $type = 'imagecreatefrom'.$typeName; $immagine = $type(this->updir.$id.'.png'le); if (is_resource($immagine)) { header('Content-type: image/jpeg'); imagejpeg($immagine,null,100); imagedestroy($immagine); break; } } header('HTTP/1.0 500 File is not an allowed image type'); -- Peter Ford phone: 01580 893333 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php