note 65656 added to function.imagecreatefromjpeg

From: Date: Fri, 05 May 2006 05:59:40 +0000
Subject: note 65656 added to function.imagecreatefromjpeg
Groups: php.notes 
Request: Send a blank email to php-notes+get-110609@lists.php.net to get a copy of this message
When working with uploaded jpeg files it is usually a good idea to execute a little but very useful program called jhead ( http://www.sentex.net/~mwandel/jhead/ ). This will clean up unnecessary jpeg header information which can cause trouble. Some cameras or applications write binary data into the headers which may result in ugly results such as strange colors when you resample the image later on. Usage: <?php exec("/path/to/jhead -purejpg /path/to/image"); // for example when you uploaded a file through a form, do this before you proceed: exec("/path/to/jhead -purejpg ".$file['tmp_name']); ?> I didn't have the chance to test this but I guess this might even solve the problem caused by images that were taken with Canon PowerShot cameras which crash PHP. This is from the jhead documentation: "-purejpg: Delete all JPEG sections that aren't necessary for rendering the image. Strips any metadata that various applications may have left in the image." jhead got some other useful options as well... ---- Server IP: 66.163.161.117 Probable Submitter: 219.89.137.135 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.imagecreatefromjpeg.php Edit -- http://master.php.net/note/edit/65656 Del: integrated -- http://master.php.net/note/delete/65656/integrated Del: useless -- http://master.php.net/note/delete/65656/useless Del: bad code -- http://master.php.net/note/delete/65656/bad+code Del: spam -- http://master.php.net/note/delete/65656/spam Del: non-english -- http://master.php.net/note/delete/65656/non-english Del: in docs -- http://master.php.net/note/delete/65656/in+docs Del: other reasons-- http://master.php.net/note/delete/65656 Reject -- http://master.php.net/note/reject/65656 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#110609) next »