From: scott dot jungwirth at demandmedia dot com Operating system: CentOS PHP version: 5.3.16 Package: EXIF related Bug Type: Feature/Change Request Bug description:please add exif_imagetypefromstring
Description: ------------ It would be nice to have an exif_imagetypefromstring function to determine an image type from a string without having to save the string to a file in order to use the exif_imagetype function. There is a getimagesizefromstring function in PHP 5.4 but exif_imagetype is supposed to be much faster as it only needs to look at the first couple of bytes of the string to determine the image type. My problem is I can't really take advantage of the faster behavior because my image data is in a string, not in a file. Test script: --------------- <?php $extension = image_type_to_extension(exif_imagetypefromstring($bin_data)); // versus $tmpfile = tempnam('/tmp', 'upload'); file_put_contents($tmpfile, $bin_data); $extension = image_type_to_extension(exif_imagetype($tmpfile)); unlink($tmpfile); -- Edit bug report at https://bugs.php.net/bug.php?id=62961&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62961&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62961&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62961&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62961&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62961&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62961&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62961&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62961&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62961&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62961&r=support Expected behavior: https://bugs.php.net/fix.php?id=62961&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62961&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62961&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62961&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62961&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62961&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62961&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62961&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62961&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62961&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62961&r=mysqlcfg