Re: Re: note 62244 rejected and deleted from function.imagecreatefromstring by notes editor nlopess
| From: | Nuno Lopes | Date: | Thu, 23 Feb 2006 23:04:28 +0000 |
| Subject: | Re: Re: note 62244 rejected and deleted from function.imagecreatefromstring by notes editor nlopess | ||
| References: | 1 2 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-104331@lists.php.net to get a copy of this message | ||
Ok, sorry I didn't understand that.
Feel free to resubmit the note again (but without advertising to your blog, please).
Regards,
Nuno
----- Original Message -----
This was not a bug with PHP but rather with the corrup JPEGS produced by the phone. This entry would help a lot of people trying to use this phone's camera produced images with PHP on mobile blogging web sites. You are receiving this email because your note postedto the online PHP manual has been removed by one of the editors. Read the following paragraphs carefully, because they contain pointers to resources better suited for requesting support or reporting bugs, none of which are to be included in manual notes because there are mechanisms and groups in place to deal with those issues. The user contributed notes are not an appropriate place to ask questions, report bugs or suggest new features; please use the resources listed on <http://php.net/support> for those purposes. This was clearly stated in the page you used to submit your note, please carefully re-read those instructions before submitting future contributions. Bug submissions and feature requests should be entered at <http://bugs.php.net/>. For documentation errors use the bug system, and classify the bug as "Documentation problem". Support and ways to find answers to your questions can be found at <http://php.net/support>. Your note has been removed from the online manual. ----- Copy of your note below ----- I run a blogging site at http://www.elmwoodstrip.org where people are posting with all kinds of phones. I know a lot of people have been having trouble using images from the Sprint PPC6700 with GD. The jpeg library always thows an error about 16 bytes of extraneous data. I decided to poke around in a hex editor and found those extraneous bytes occur right at the end of the exif data and consist of the following hex string \x00\x10\x4A\x46\x49\x46\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00 By removing this extraneous data, images can easily be manipulated by GD and the EXIF extension as a normal images. This also removes any problems using the images with GIMP which must rely on the same jpeg libraries. Here is a function that will check to see if an image is from the PPC6700 and then remove the extraneous data for you. The result can successully be used with imagecreatefromstring function checkFixPPC6700($orig){ //get the file contents $data = file_get_contents($orig); //if its a PPC 6700 image cut out the extraneous 16 bits if(strstr($data, "\x41\x70\x61\x63\x68\x65\x00\x48")){ $bad_data = "\x00\x10\x4A\x46\x49\x46\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00"; return substr_replace($data, "", strpos($data, $bad_data), strlen($bad_data)); } else { //if not from a PPC 6700 return data unaltered return $data; } }-- PHP Notes Mailing List (http://www.php.net/)