{"id":15978,"date":"2015-07-15T05:01:56","date_gmt":"2015-07-14T19:01:56","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=15978"},"modified":"2016-08-08T13:39:38","modified_gmt":"2016-08-08T03:39:38","slug":"php-exif-image-information-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-exif-image-information-primer-tutorial\/","title":{"rendered":"PHP Exif Image Information Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/exif_tester.php\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"PHP Exif Image Information Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/exif_primer.jpg\" title=\"PHP Exif Image Information Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">PHP Exif Image Information Primer Tutorial<\/p><\/div>\n<p>Our (Mac OS X laptop) local <a target=_blank href='https:\/\/www.mamp.info\/' title='MAMP Apache\/PHP\/MySql web server landing page'>MAMP<\/a> web server is an Apache\/PHP\/MySql web server.  In this environment you can find out a lot with some PHP code as per &#8230;<\/p>\n<p><code>&lt;?php <a target=_blank href='http:\/\/php.net\/manual\/en\/function.phpinfo.php' title='PHP phpinfo() method information'>phpinfo();<\/a> ?&gt;<\/code><\/p>\n<p> &#8230; and if, in doing this, you find a reference to the <a target=_blank href='http:\/\/php.net\/manual\/en\/book.exif.php' title='Exchangeable Image Information'>&#8220;exif&#8221;<\/a> Exchangeable Image Information functionality existing, you are a lucky candidate to introduce some image &#8220;interrogation&#8221; (but not <a target=_blank title='?' href='http:\/\/www.youtube.com\/watch?v=vt0Y39eMvpI'>this<\/a>) logic to your PHP code.<\/p>\n<p>We followed a lot of the advice of the very useful <a target=_blank title='PHP exif imagetype information' href='http:\/\/php.net\/manual\/en\/function.exif-imagetype.php'>link<\/a> (thanks) to create some PHP called &#8230;<\/p>\n<ul>\n<li><a target=_blank title='exif_tester.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/exif_tester.php_GETME'>exif_tester.php<\/a><\/li>\n<\/ul>\n<p> &#8230; where we may (or maybe not) be waking you up (<a target=_blank title='?' href='http:\/\/www.youtube.com\/watch?v=pIgZ7gMze7A'>before we go go<\/a> <i>&#8216;Cause I&#8217;m not plannin&#8217; on going solo<\/i> yo (to be honest, like)) &#8230; it&#8217;s a slow news day &#8230; to the fact that images can show on a web page but may not be all you would understand them to be &#8230; shock, horror!<\/p>\n<p>Yes, an image that is a GIF in all but name will often display fine even if it&#8217;s been given a name like MyNameIs.Jpeg <strike>man<\/strike> person.<\/p>\n<p>If this <i><b>outrage<\/b><\/i> makes you &#8230;<\/p>\n<ul>\n<li>a) fall on the floor laughing<\/li>\n<li>b) cause a road rage incident<\/li>\n<li>c) wake up in a cold sweat<\/li>\n<li>d) wake up in a warmish to lukewarm sweat<\/li>\n<li>e) tear the cat&#8217;s hair out <font size=0>(no animals were harmed in the making of this blog posting)<\/font><\/li>\n<\/ul>\n<p> &#8230; then we&#8217;re here to tell you that you need to take a <a target=_blank title='Take a Bex ... and ...' href='https:\/\/www.youtube.com\/watch?v=BF6ffbz70SY'>Bex<\/a> and have a lie down.<\/p>\n<p>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 <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/exif_tester.php\" title='Click picture'>live run<\/a>.  Sometimes you&#8217;ll see <a target=_blank title='Gimp' href='http:\/\/gimp.org'>Gimp<\/a> using exif functionality when it becomes aware of the possibility your image could be rotated to advantage &#8230; we&#8217;ve had this happen and thanked Gimp with more than the usual toast and herbal tea offerings you&#8217;d be used to giving &#8230; we take it?!<\/p>\n<p><b><i>Stop Press<\/i><\/b><\/p>\n<p>As of 8\/8\/2016 (<font size=1>well, what do you know? &#8230; understood everywhere!?<\/font>) we&#8217;re revisiting Exif and PHP to learn more and our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/exif_primer.jpg\">tutorial picture<\/a> now reflects the early days of the revisit and the new resultant PHP we wrote, that you could call <a target=_blank title='read_exif_off_image.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image.php_GETME'>read_exif_off_image.php<\/a>, inspired, largely from <a target=_blank title=Useful href=http:\/\/www.v-nessa.net\/2010\/08\/02\/using-php-to-extract-image-exif-data>http:\/\/www.v-nessa.net\/2010\/08\/02\/using-php-to-extract-image-exif-data<\/a> (thanks), and has this <a target=_blank title='Live Run' href='http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image.php?image=http:\/\/www.rjmprogramming.com.au\/Mindfulness\/clouds.jpg'>live run<\/a> link, the output of which is pointed to by the red arrow in the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/exif_primer.jpg\">tutorial picture<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d15978' onclick='var dv=document.getElementById(\"d15978\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/?tag=gimp\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d15978' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8230; &lt;?php phpinfo(); ?&gt; &#8230; and if, in doing this, you &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-exif-image-information-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,16,37],"tags":[406,491,590,591,744,932,1558,997,1200,1319],"class_list":["post-15978","post","type-post","status-publish","format-standard","hentry","category-elearning","category-gimp","category-tutorials","tag-exif","tag-gimp","tag-image","tag-image-editing","tag-mamp","tag-php","tag-phpinfo","tag-programming","tag-stop-press","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/15978"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=15978"}],"version-history":[{"count":9,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/15978\/revisions"}],"predecessor-version":[{"id":23959,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/15978\/revisions\/23959"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=15978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=15978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=15978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}