{"id":33778,"date":"2017-10-17T03:01:27","date_gmt":"2017-10-16T17:01:27","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=33778"},"modified":"2017-10-16T20:18:25","modified_gmt":"2017-10-16T10:18:25","slug":"php-imagemagick-image-dimensions-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-imagemagick-image-dimensions-primer-tutorial\/","title":{"rendered":"PHP ImageMagick Image Dimensions Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/image_dimensions.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP ImageMagick Image Dimensions Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/image_dimensions.jpg\" title=\"PHP ImageMagick Image Dimensions Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP ImageMagick Image Dimensions Primer Tutorial<\/p><\/div>\n<p>We revisit the talents of the brilliant <a target=_blank title='ImageMagick' href='http:\/\/www.imagemagick.org'>ImageMagick<\/a>&#8216;s <i>Identify<\/i> command featuring, last, in <a title='Location Services iPad Camera Geolocation Png Metadata Tutorial' href='#lspcgpmt'>Location Services iPad Camera Geolocation Png Metadata Tutorial<\/a> to start down the road of a <i>web server image information presenter<\/i> web application.<\/p>\n<p>With ImageMagick command line &#8230;<\/p>\n<p><code><br \/>\nidentify [webServerImageFileSpec]<br \/>\n<\/code><\/p>\n<p> &#8230; sums up what we build a web application around, having a PHP shell use its <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'><i>exec<\/i><\/a> method to filter the information through (Linux command line) &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Linux awk command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/uawk.htm'>awk<\/a> # command line processor repeats column field data<\/li>\n<li><a target=_blank title='Linux sed command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/used.htm'>sed<\/a> # command line editor most associated with pipe commands<\/li>\n<\/ul>\n<p> &#8230; to result in the table contents of our image (specification) table in our web application today.<\/p>\n<p>You can try this out for yourself at today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/image_dimensions.php\" title=\"Click picture\">live run<\/a> link with its underlying serverside PHP code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/image_dimensions.php_GETME\" title=\"image_dimensions.php\">image_dimensions.php<\/a> as you wish.<\/p>\n<hr>\n<p id='lspcgpmt'>Previous relevant <a target=_blank title='Location Services iPad Camera Geolocation Png Metadata Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/location-services-ipad-camera-geolocation-png-metadata-tutorial\/'>Location Services iPad Camera Geolocation Png Metadata Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image_rotate.php?animg=http:\/\/www.rjmprogramming.com.au\/IMG_0550.PNG\"><img decoding=\"async\"   style=\"float:left; border: 15px solid pink;\" alt=\"Location Services iPad Camera Geolocation Png Metadata Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif.JPG\" title=\"Location Services iPad Camera Geolocation Png Metadata Tutorial\" \/><\/a><p class=\"wp-caption-text\">Location Services iPad Camera Geolocation Png Metadata Tutorial<\/p><\/div>\n<p>Today&#8217;s &#8220;foot further into the water&#8221; progress building on <a title='Location Services iPad Camera Geolocation Jpeg Exif Tutorial' href='#lsicgjet'>Location Services iPad Camera Geolocation Jpeg Exif Tutorial<\/a>, as shown below, has a posting title that includes the word &#8220;Geolocation&#8221;, but alas, we&#8217;ve found with PNG files coming off our iPad that Geolocation or Geotagging information is lost, unlike our recent iPad JPEG files, and so our preference for the latter has become stronger.  We discuss this also at WordPress 4.1.1&#8217;s <a target=_blank title='Location Services iPad Camera Geolocation Png Metadata Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/location-services-ipad-camera-geolocation-png-metadata-tutorial\/'>Location Services iPad Camera Geolocation Png Metadata Tutorial<\/a>.  However, there are other interesting pieces of information regarding an image that don&#8217;t involve the &#8220;where&#8221; of life, and so we find this topic interesting even so, and hope you do too.<\/p>\n<p>As with so many issues in Information Technology, there are often many approaches to solving problems, and we took the first approach of just some of the possibilities for approaches to PNG metadata processing, listed below &#8230;<\/p>\n<ul>\n<li><a target=_blank title='ImageMagick command line' href='http:\/\/www.imagemagick.org\/script\/command-line-tools.php'>ImageMagick command line<\/a> functionality via &#8220;identify&#8221; command<\/li>\n<li><a target=_blank href='http:\/\/php.net\/manual\/en\/imagick.getimageproperties.php' title='Imagick class'>Imagick class<\/a> in PHP<\/li>\n<li><a target=_blank title=ExifTool href='http:\/\/www.sno.phy.queensu.ca\/%7Ephil\/exiftool\/index.html'>ExifTool<\/a> third party solution in Perl<\/li>\n<\/ul>\n<p> &#8230; and so, once again, we find useful work for the wonderful ImageMagick software product for our purposes.  As we say, our foot is just further in the water, and there is more analysis and testing we feel necessary here, but hope this helps you out or is a source of ideas for you.<\/p>\n<p>We leave you with the reworked <a target=_blank title='read_exif_off_image_rotate.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image_rotate.php---GETME'>read_exif_off_image_rotate.php<\/a>, changed <a target=_blank title='read_exif_off_image_rotate.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image_rotate.php---GETME'>this way<\/a>, that has this corresponding new <a target=_blank title='Live Run' href='http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image_rotate.php?animg=http:\/\/www.rjmprogramming.com.au\/IMG_0550.PNG'>live run<\/a>.<\/p>\n<hr \/>\n<p id='lsicgjet'>Previous relevant <a target=_blank title='Location Services iPad Camera Geolocation Jpeg Exif Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/location-services-iPad-camera-geolocation-JPEG-exif-tutorial\/'>Location Services iPad Camera Geolocation Jpeg Exif Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image_rotate.php?image=http:\/\/www.rjmprogramming.com.au\/IMG_0536.JPG\"><img decoding=\"async\"   style=\"float:left; border: 15px solid pink;\" alt=\"Location Services iPad Camera Geolocation Jpeg Exif Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/IMG_0558.PNG\" title=\"Location Services iPad Camera Geolocation Jpeg Exif Tutorial\" \/><\/a><p class=\"wp-caption-text\">Location Services iPad Camera Geolocation Jpeg Exif Tutorial<\/p><\/div>\n<p>Maybe you were here when we left off with <a title='Location Services iPad Camera Geolocation Primer Tutorial' href='#lsicgpt'>Location Services iPad Camera Geolocation Primer Tutorial<\/a> as shown below &#8230;<\/p>\n<ul>\n<li>amazed at the power of mobile devices, specifically an iPad, with their Camera apps and Geolocation data &#8230; and\/or &#8230;<\/li>\n<li>not knowing enough &#8230; and still not &#8230; about when the iPad chooses to output the photograph in *.PNG or *.JPG &#8230; ie. the blurb below about meta data versus exif data &#8230; and &#8230;<\/li>\n<li>vowing to be like Fu Manchu &#8230; so here we are\n<\/ul>\n<p>Okay, you might want to read more about that iPad decision regarding *.PNG versus *.JPG, and you may want to start <a target=_blank title='PNG vs JPG on iPad Camera' href='https:\/\/discussions.apple.com\/thread\/4475996?start=0&#038;tstart=0'>here<\/a>, but in any case, with our fish photographs from that day we got a mix of &#8230;<\/p>\n<ul>\n<li>JPG<\/li>\n<li>PNG<\/li>\n<\/ul>\n<p> &#8230; and as far as teeing into Geolocation (or <a target=_blank title='Geotagging information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Geotagging'>Geotagging<\/a>) data goes we, so far, much prefer JPG, because we can use PHP exif methods, and today&#8217;s tutorial is about that, building on what we did at <a target=_blank title='PHP Exif Image Information Rotation Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/php-exif-image-information-rotation-tutorial\/'>PHP Exif Image Information Rotation Tutorial<\/a>.  As far as the PNG photos go &#8230; well, there&#8217;s more to do regarding metadata considerations, and we haven&#8217;t given up on that &#8230; but that is for another day.  In the meantime, enjoy the reworked <a target=_blank title='read_exif_off_image_rotate.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image_rotate.php--GETME'>read_exif_off_image_rotate.php<\/a>, changed <a target=_blank title='read_exif_off_image_rotate.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image_rotate.php--GETME'>this way<\/a>, that has this corresponding new <a target=_blank title='Live Run' href='http:\/\/www.rjmprogramming.com.au\/PHP\/read_exif_off_image_rotate.php?image=http:\/\/www.rjmprogramming.com.au\/IMG_0536.JPG'>live run<\/a> link to show that GPS data we haven&#8217;t seen up until the fish photographs, and interpreting the exif data now, means we can display a Google Chart Map Chart &#8230;<\/p>\n<p><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Location Services iPad Camera Geolocation Jpeg Exif Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/IMG_0559.PNG\" title=\"Location Services iPad Camera Geolocation Jpeg Exif Tutorial\" \/><\/p>\n<p> &#8230; showing the Geolocation context of where and when, and even how high up, this photograph was taken.  Cute, huh?!<\/p>\n<hr \/>\n<p id='lsicgpt'>Previous relevant <a target=_blank title='Location Services iPad Camera Geolocation Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/location-services-ipad-camera-geolocation-primer-tutorial\/'>Location Services iPad Camera Geolocation Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/IMG_0548.PNG\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Location Services iPad Camera Geolocation Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/IMG_0548.PNG\" title=\"Location Services iPad Camera Geolocation Primer Tutorial\" \/><\/a><p class=\"wp-caption-text\">Location Services iPad Camera Geolocation Primer Tutorial<\/p><\/div>\n<p>We had occasion to read <a target=_blank title='Resetting Location Services Google search information' href='https:\/\/www.google.com.au\/search?q=stackoverflow+resetting+location+services&#038;ie=utf-8&#038;oe=utf-8&#038;client=firefox-b-ab&#038;gfe_rd=cr&#038;ei=RCUMWLfaBKvr8Ae04ZewBg#q=resetting+location+services'>here<\/a> about resetting <a target=_blank title='iOS Location Services information from Apple' href='https:\/\/support.apple.com\/en-au\/HT203033'>Location Services<\/a> on an iPad &#8230; which, we need to say, you&#8217;d only read about and contemplate if something you&#8217;ve done has stopped a Geolocation thing you wanted to happen to no longer happen and you&#8217;ve ruled out tweaks to Location Service individual app settings with regard to this  (and you may have been in on the discussion we had with some time back with <a target=_blank title='Location Services iPad Battery Loss Issue Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/location-services-ipad-battery-loss-issue-tutorial\/'>Location Services iPad Battery Loss Issue Tutorial<\/a>) &#8230; and the result of doing this opened up the iPad&#8217;s Camera app for permission for Location Services to record <a target=_blank title='Geolocation information from Wikipedia' href='https:\/\/en.wikipedia.org\/wiki\/Geolocation'>Geolocation<\/a> data, and it looks like, time, information on the photographs you take.  We also explore this subject at WordPress 4.1.1&#8217;s <a target=_blank title='Location Services iPad Camera Geolocation Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/location-services-ipad-camera-geolocation-primer-tutorial\/'>Location Services iPad Camera Geolocation Primer Tutorial<\/a>.  Presumably, this happens in the photograph&#8217;s <a target=_blank title='Exif information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Exif'>exif<\/a> data, perhaps (am not promising, might pan out to be metadata) &#8230; which interests us as well, and we&#8217;ll go into that more soon.<\/p>\n<p>So we used this functionality, as well as zooming in on some fish in our pond for today&#8217;s digital photography <a target=_blank title='Mindfulness' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/mindfulness'>sojourn<\/a>.  Maybe seeing fish is a source of <a target=_blank title='Mindfulness information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Mindfulness'>mindfulness<\/a> &#8230;<\/p>\n<p><img src='http:\/\/www.rjmprogramming.com.au\/IMG_0550.PNG' title='Fish'><\/img><\/p>\n<p><iframe style='width:100%;' src='http:\/\/www.rjmprogramming.com.au\/spec_img.php?imgurls=http:\/\/www.rjmprogramming.com.au\/IMG_054*.JPG,http:\/\/www.rjmprogramming.com.au\/IMG_053*.JPG' title='Glob img spec'><\/iframe><\/p>\n<p> &#8230; for you, as it seems to help for me?<\/p>\n<p>The Geolocation aspects are great, as you can imagine, for helping document a trip, in pictures, even well after the event, if you can get the context of where you are when a photograph is taken.<\/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='#d25891' onclick='var dv=document.getElementById(\"d25891\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/ipad\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d25891' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\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='#d25966' onclick='var dv=document.getElementById(\"d25966\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/photography\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d25966' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\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='#d26059' onclick='var dv=document.getElementById(\"d26059\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/ImageMagick\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d26059' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\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='#d33778' onclick='var dv=document.getElementById(\"d33778\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/image\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d33778' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We revisit the talents of the brilliant ImageMagick&#8216;s Identify command featuring, last, in Location Services iPad Camera Geolocation Png Metadata Tutorial to start down the road of a web server image information presenter web application. With ImageMagick command line &#8230; &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-imagemagick-image-dimensions-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,37],"tags":[234,2365,405,2258,590,1658,707,932,997,1238,1319,2257],"class_list":["post-33778","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-command-line","tag-dimensions","tag-exec","tag-height","tag-image","tag-imagemagick","tag-linux","tag-php","tag-programming","tag-table","tag-tutorial","tag-width"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33778"}],"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=33778"}],"version-history":[{"count":3,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33778\/revisions"}],"predecessor-version":[{"id":33781,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33778\/revisions\/33781"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=33778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=33778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=33778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}