PHP Exif Image Information Primer Tutorial

PHP Exif Image Information Primer Tutorial

PHP Exif Image Information Primer Tutorial

Our (Mac OS X laptop) local MAMP web server is an Apache/PHP/MySql web server. In this environment you can find out a lot with some PHP code as per …

<?php phpinfo(); ?>

… and if, in doing this, you find a reference to the “exif” Exchangeable Image Information functionality existing, you are a lucky candidate to introduce some image “interrogation” (but not this) logic to your PHP code.

We followed a lot of the advice of the very useful link (thanks) to create some PHP called …

… where we may (or maybe not) be waking you up (before we go go ‘Cause I’m not plannin’ on going solo yo (to be honest, like)) … it’s a slow news day … to the fact that images can show on a web page but may not be all you would understand them to be … shock, horror!

Yes, an image that is a GIF in all but name will often display fine even if it’s been given a name like MyNameIs.Jpeg man person.

If this outrage makes you …

  • a) fall on the floor laughing
  • b) cause a road rage incident
  • c) wake up in a cold sweat
  • d) wake up in a warmish to lukewarm sweat
  • e) tear the cat’s hair out (no animals were harmed in the making of this blog posting)

… then we’re here to tell you that you need to take a Bex and have a lie down.

In any case, there is a solution to this in PHP if the exif functionality is available to you, and this matter is of concern, and you can see us showing you how to test for that with the code above and this live run. Sometimes you’ll see Gimp using exif functionality when it becomes aware of the possibility your image could be rotated to advantage … we’ve had this happen and thanked Gimp with more than the usual toast and herbal tea offerings you’d be used to giving … we take it?!

Stop Press

As of 8/8/2016 (well, what do you know? … understood everywhere!?) we’re revisiting Exif and PHP to learn more and our tutorial picture now reflects the early days of the revisit and the new resultant PHP we wrote, that you could call read_exif_off_image.php, inspired, largely from http://www.v-nessa.net/2010/08/02/using-php-to-extract-image-exif-data (thanks), and has this live run link, the output of which is pointed to by the red arrow in the tutorial picture.

If this was interesting you may be interested in this too.

This entry was posted in eLearning, GIMP, Tutorials and tagged , , , , , , , , , . Bookmark the permalink.

16 Responses to PHP Exif Image Information Primer Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *