3v4l.org

run code in 300+ PHP versions simultaneously
<? ini_set('display_errors', 'On'); error_reporting(E_ALL); // determine image format print "1\n"; if (exif_imagetype('http://23mox.com/php/GoogleMapAPI/IMG_0266_mod.JPEG') == IMAGETYPE_JPEG) { print "Hey, this is a JPEG image"; } print "2"; // extra thumbnail from EXIF data, this sometimes help and you // do not need to generate your own thumbnails, most digital // cameras provide a thumbnail $thumb_image = exif_thumbnail($original_file, $width, $height, $type); print "Height: $height \nWidth: $width \nType: $type"; // save thumbnail to a file file_put_contents($path_to_thumb_image,$thumb_image); // read all available tags into an associative array $exif_data = exif_read_data($original_file, 'ANY_TAG'); foreach ($exif_data as $key => $section_data) { foreach ($section_data as $name => $val) { print "$key.$name : $val \n"; } } ?>
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
<? ini_set('display_errors', 'On'); error_reporting(E_ALL); // determine image format print "1\n"; if (exif_imagetype('http://23mox.com/php/GoogleMapAPI/IMG_0266_mod.JPEG') == IMAGETYPE_JPEG) { print "Hey, this is a JPEG image"; } print "2"; // extra thumbnail from EXIF data, this sometimes help and you // do not need to generate your own thumbnails, most digital // cameras provide a thumbnail $thumb_image = exif_thumbnail($original_file, $width, $height, $type); print "Height: $height \nWidth: $width \nType: $type"; // save thumbnail to a file file_put_contents($path_to_thumb_image,$thumb_image); // read all available tags into an associative array $exif_data = exif_read_data($original_file, 'ANY_TAG'); foreach ($exif_data as $key => $section_data) { foreach ($section_data as $name => $val) { print "$key.$name : $val \n"; } } ?>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 <? ini_set('display_errors', 'On'); error_reporting(E_ALL); // determine image format print "1\n"; if (exif_imagetype('http://23mox.com/php/GoogleMapAPI/IMG_0266_mod.JPEG') == IMAGETYPE_JPEG) { print "Hey, this is a JPEG image"; } print "2"; // extra thumbnail from EXIF data, this sometimes help and you // do not need to generate your own thumbnails, most digital // cameras provide a thumbnail $thumb_image = exif_thumbnail($original_file, $width, $height, $type); print "Height: $height \nWidth: $width \nType: $type"; // save thumbnail to a file file_put_contents($path_to_thumb_image,$thumb_image); // read all available tags into an associative array $exif_data = exif_read_data($original_file, 'ANY_TAG'); foreach ($exif_data as $key => $section_data) { foreach ($section_data as $name => $val) { print "$key.$name : $val \n"; } } ?>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.6, 7.3.32 - 7.3.33, 7.4.33, 8.0.13
1 Fatal error: Uncaught Error: Call to undefined function exif_imagetype() in /in/k2jni:8 Stack trace: #0 {main} thrown in /in/k2jni on line 8
Process exited with code 255.
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28
1 Fatal error: Call to undefined function exif_imagetype() in /in/k2jni on line 8
Process exited with code 255.

preferences:
180.95 ms | 402 KiB | 214 Q