Yes, we do believe that of the PHP modes of use, those being โฆ
- surfing the net
- command line
- curl
โฆ there can be a role for curl as that hybrid โbit of both worldsโ mode of use with todayโschanged find_images_via_sizephp that can be downloaded or tried out at this live
run link.
That circumstance is regarding when a user is online (ie. starts out โsurfing the netโ) and would prefer an option to just see the Image Dimensions report as a really simple โno bells and whistlesโ offering. Though there are ways, at least with Linux (and macOS) tee command to do this quite neatly and stay in โsurfing the netโ mode. But this did not appeal to us now that we support Windows as the underlying operating system. And this is where โcurlโ being that hybrid is interesting, and there is โdelimitationโ interest galore in our idea to, for this โsimple report curl subprojectโ โฆ
- within โsurfing the netโ mode offer a new HTML form input type=button as per โฆ
<input style='background-color:orange;font-size:20px;' type=button onclick='shortlist();' value=Short></input> - with Javascript event logic as per โฆ
function shortlist() {
var ccmd=document.URL.split('?')[0].split('#')[0] + '?curl=' + encodeURIComponent('-p') + encodeURIComponent(String.fromCharCode(9)) + encodeURIComponent(document.getElementById('path').title) + encodeURIComponent(String.fromCharCode(9)) + encodeURIComponent('-f') + encodeURIComponent(String.fromCharCode(9)) + encodeURIComponent(document.getElementById('filespec').title);
var sels=document.getElementsByTagName('select');
for (var isels=0; isels<sels.length; isels++) {
if (('' + sels[isels].title) != '') {
ccmd+=encodeURIComponent(String.fromCharCode(9)) + encodeURIComponent(sels[isels].title);
}
}
location.href=ccmd;
} - feeding off the way we now utilize HTML form element (user) data collection element title attributes in conjunction with Javascript functions โฆ
function selsett(os) {
for (var i=0; i<os.length; i++) {
if (os.options[i].selected) {
if (os.id == 'wo') {
os.title=(os.options[i].title.replace(/\ /g,String.fromCharCode(9)) + String.fromCharCode(9) + document.getElementById('wv').value + String.fromCharCode(9)).replace(' ',' ').replace(' ',' ').replace(' ',' ');
} else if (os.id == 'ho') {
os.title=(os.options[i].title.replace(/\ /g,String.fromCharCode(9)) + String.fromCharCode(9) + document.getElementById('hv').value + String.fromCharCode(9)).replace(' ',' ').replace(' ',' ').replace(' ',' ');
} else {
os.title=os.options[i].title.replace(/\ /g,String.fromCharCode(9));
}
}
}
}
function sett(os) {
if (os.id == 'wv') {
selsett(document.getElementById('wo'));
os.title='';
} else if (os.id == 'hv') {
selsett(document.getElementById('ho'));
os.title='';
} else {
os.title=os.value;
}
} - where the String.fromCharCode(9) (horizontal tab) delimitation used is a hint that โcurlโ might be the โend gameโ here โฆ huh?! โฆ well, โcurlโ is called from the command line (or we do it in PHP โsurfing the netโ mode via exec) and it takes as its argument an absolute URL, which as you probably know consists of โ[absoluteURL]?arg1name=arg1value&arg2name=arg2valueโ type of arrangement โฆ Linux/macOS alert!!! (and we all know the woooooorrrrrllllldd needs more lerts โฆ but we digress) โฆ in Linux/macOS โ&โ has that other meaning of โput command into backgroundโ โฆ so rather than trying to work out โcurlโ syntax in this scenario weโve always used alternative delimitation ideas (hence the tabs) in the one (now far more complex) โ?arg1name=arg1valueโ data arrangement โฆ leading to us โฆ
- recalling โsurfing the netโ with that function shortlist ?curl=[complexArg1Value] and on that re-entry use the PHP to โฆ
if (isset($_GET['curl'])) { // in surfing the net mode wanting to call a curl mode of use execution
exec("curl \"" . "HTTP://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "" . str_replace("find_images_via_size.php","",explode("#",explode("?",$_SERVER['REQUEST_URI'])[0])[0]) . "find_images_via_size.php?commandline=" . urlencode(str_replace("+"," ",urldecode($_GET['curl']))) . "\"");
echo "<!doctype html><html><head><title>Find Images Via Size - RJM Programming - October, 2019</title><meta charset='utf-8'></head><body><div>FindโImagesโViaโSize<br><br>RJMโProgrammingโ-โOctober,โ2019<br><br><br>WidthโxโHeightโFile<br>" . str_replace(" ","โ",str_replace("\n","<br>", file_get_contents("find_images_via_size.txt"))) . "</div></body></html>";
exit;
}
if (isset($_GET['commandline'])) { // in curl mode
$gcl=str_replace("+"," ",urldecode($_GET['commandline']));
if (!isset($argc)) {
if (strpos($gcl, "\t") !== false) {
$argv=explode("\t", "file_images_via_size.php\t" . $gcl);
$argc=sizeof($argv);
for ($ii=0; $ii<$argc; $ii++) {
$argv[$ii]=trim($argv[$ii]); // join "command line" mode of use logic
}
valit('','');
}
}
}
โฆ rejoin โcommand lineโ mode of use logic by inventing our own (does not normally exist with โcurlโ) $argv array of size $argc โฆ and โฆ - you can output Image Dimension report data in that simplified way to the webpage (rather than the command line) and make use of that (use of)   advice we got from this useful link regarding tabstop spacing simulation on a webpage (without using table elements) โฆ thanks
โฆ adding onto that โcommand lineโ mode of use โpushโ of yesterdayโs PHP Image Dimensions Linux and Windows Glob Command Line Tutorial.
Previous relevant PHP Image Dimensions Linux and Windows Glob Command Line Tutorial is shown below.
Yesterdayโs PHP Image Dimensions Linux Find File Awk Sed Javascript Tutorial helped out a PHP โฆ
- โsurfing the netโ mode of use โฆ but what if you are on Windows? (well, today we link up PHPโs globโs organizational skills with its image interrogation getimagesize skills to help) โฆ and as far as โฆ
- โcommand lineโ mode of use โฆ yes, that could be useful as a report with brevity โฆ no links, nor webpages, but still lots of the data of interest in a text Image Dimensions report
Differentiating these two different modes of use in PHP? Pretty simple really โฆ
<?php
if (isset($argc)) {
// do command line mode of use logics here
} else {
// do surfing the net (or perhaps, curl), modes of use here logics here
}
?>
If this is of interest, take a skeg at todayโschanged find_images_via_sizephp that can be downloaded or tried out at this live
run link.
Previous relevant PHP Image Dimensions Linux Find File Awk Sed Javascript Tutorial is shown below.
Itโs a little bit funny, this feeling inside, how yesterdayโs PHP Image Dimensions Linux Find File Awk Sed UX Tutorial was about UX (or user experience), what to our eyes very much involves โfront-endโ concepts, yet the vast majority of work done on this remained on the โserverโ side of the software coding ledger. Even our one tiny foray (via โOperation 4Ay U Over There, โguvโ) into Javascript โclient landโ we used to set non-default select (dropdown) element values on analyzing posted data we could have handled in โserver landโ by inserting some โselectedโ HTML element attributes. And so, yesterday, we didnโt even have a โscriptโ tag within a โheadโ tag, which is quite unusual.
Not so today, though, where we unleash Javascript in all its glorious โclient sideโ partnership with the โserver sideโ PHP, as a layer of web application logic for immediately before the user sees the web page, from that time when a โweb browser address bar URLโ equates to Javascript DOMโs โdocument.URLโ, through โdocument onloadโ event logic and responding to user actions. Today, in this regard, we convert that hardcoded โxโ between the width column and the height column into a select (dropdown) element initially showing that โxโ but selectable so that โฆ
- Exif Information
- Blog Search
- Animated GIF Creation
โฆ โclient facingโ functionalities have been added with todayโschanged find_images_via_sizephp that can be downloaded or tried out at this live
run link.
Please note with Node.js Javascript is used as a โserverโ language and โclientโ language. Interesting, huh?!
Previous relevant PHP Image Dimensions Linux Find File Awk Sed UX Tutorial is shown below.
Yesterdayโs PHP Image Dimensions Linux Find File Awk Sed Primer Tutorial set the scene for a new approach to an Image by Dimension Size web application idea. Today we turn our attention to โฆ
- user experience (ie. UX) functionality improvements โฆ
- user experience fixes for annoyances
โฆ both contributors to the overall viability of a web application project.
What are some examples of this for this project? Weโd say the offering of several โsorting of dataโ mechanisms falls into the โimprovementsโ category. The moving of the โformโ back above the fold when there is a report to show is the fix of an annoyance, and, it pans out, an improvement, because we take advantage of this change to โฆ
- make it an optional โreadโ for non-IE and non-Edge users by encasing it in a โreveal starโ details tag (and its nested summary) HTML element encasing (initially set to โhideโ) โฆ as well as โฆ
- start initializing form defaults according to user designations so that the form can also be like a report header helper, to explain the Image Find Parameters of an execution run
The emoji hashtag navigation? Doesnโt matter either way, but at least brings attention to a navigational offering.
So hereโs the thing. Am sure you can think of a whole swag of offerings to improve. It is up to the programmer, or user acceptance test results, to try to imagine improvement ideas and to imagine what might annoy. On hover (for non-mobile users) over an image link, for example, we faintly show that image full size as a (total) webpage background image. There might be those who hate any overlay clashes to be annoyed by what we were hoping would be an UX functional improvement. More assured, weโd say, are the newly displayed thumbnail images next to the (image) URLs, that when clicked, still go off showing the user the full image in a new (target=_blank) window (or tab โฆ which is a web browser setting of your choosing, to do with the web browser). UX considerations are subjective by nature, though you can look around the net and see lots of doโs and donโts talked about ad infinitum with regard to UX.
So, โUX-wiseโ see thechanged find_images_via_sizephp that can be downloaded or tried out at this live
run link.
Previous relevant PHP Image Dimensions Linux Find File Awk Sed Primer Tutorial is shown below.
Weโve written web applications to list image files via their dimension, based on the incredible ImageMagick, when we presented the blog post thread ending with PHP ImageMagick Image Dimensions Sort Tutorial. But ImageMagick, alas, does not come out of the box with an operating system, always. Looking for an image bigger than or equal to a particular dimension yesterday, our online research had us thinking, โWhat about a macOS (or Mac OS X) and Linux โPHP supervises exec supervises find pipes file pipes awk pipes sedโ solution (inspired by this useful link, thanks), relying on not much more than having a Unix (ie. Linux) shell?โ Sounds good?! And why, pray tell, when macOS has the Finder desktop app? Well, remarkably, here with macOS Mojave, we think weโve seen better times showing image dimensions. But even if we have missed something, weโre looking for โฆ
- a report โฆ ideally โฆ
- tabularized โฆ ideally โฆ
- linkable to the images themselves โฆ and user interactive tailorable as far as being able to โฆ
- define width and height operator and value constraints (eg. width >= 567 and height < 751)
โฆ which is all beyond a GUI like macOSโs Finder desktop app. But it isnโt beyond our โPHP supervises exec supervises find pipes file pipes awk pipes sedโ solution called find_images_via_sizephp that can be downloaded or tried out at this live
run link.
Weโve long admired unixโs (ie. Linuxโs) sed but our admiration grew with todayโs project. It truly is a star of a piece of software functionality. The modesty of โman sedโโs โsed โ stream editorโ heading belies the power of the combination โฆ
- โstreamโ being any text piped to it โฆ and โฆ
- โeditorโ which covers a lot more than just a โฆ
- โsubstitutingโ tool โฆ when you consider its โregexโ type syntax particularly featuring its โgroup regexโ syntax today allowing it to be โฆ
- โexpanding and repeating of dataโ tool โฆ eg. find occurrence 1, replace with find occurrence (or back-reference) 1, find occurrence 2, replace with find occurrence (or back-reference) 2,
$ echo " in Spain " | sed 's/\(\ \)\(in\ [^\ ]*\)/The rain\1\2\1falls mainly on the plain./g'
The rain in Spain falls mainly on the plain.
$
Add the incredible Linux (and macOS command line) find and file and awk into the mix and behind the scenes of our PHP web application and PHP could have fed exec (after a quiche entree) โฆ for the example of our MAMP document root HTTP://localhost:888/find_images_via_size.php address bar URL โฆ
cd /Applications/MAMP/htdocs; find . -name '*.*g' -exec file {} \; | sed 's/\(.*g\): .* \([0-9]* x [0-9]*\).*/\2 \1/' | awk 'int($1) > 500 && int($3) > 500 {print}' | sed 's/\(\ \)\(\.[^\<]*\)/\ \<a target=_blank title="\/Applications\/MAMP\/htdocs\/\2" href="\2"\>\2\<\/a\>/g'
โฆ resulting in (the first five lines of result set) โฆ
625 x 896 <a target=_blank title="/Applications/MAMP/htdocs/./HTMLCSS/MIDI.js-master/examples/images/tuna.png" href="./HTMLCSS/MIDI.js-master/examples/images/tuna.png">./HTMLCSS/MIDI.js-master/examples/images/tuna.png</a>
2880 x 1800 <a target=_blank title="/Applications/MAMP/htdocs/./HTMLCSS/web_audio.png" href="./HTMLCSS/web_audio.png">./HTMLCSS/web_audio.png</a>
800 x 563 <a target=_blank title="/Applications/MAMP/htdocs/./vmcommerce/administrator/templates/hathor/template_preview.png" href="./vmcommerce/administrator/templates/hathor/template_preview.png">./vmcommerce/administrator/templates/hathor/template_preview.png</a>
800 x 767 <a target=_blank title="/Applications/MAMP/htdocs/./vmcommerce/templates/atomic/template_preview.png" href="./vmcommerce/templates/atomic/template_preview.png">./vmcommerce/templates/atomic/template_preview.png</a>
2880 x 1800 <a target=_blank title="/Applications/MAMP/htdocs/./stopPropagation_preventDefault.png" href="./stopPropagation_preventDefault.png">./stopPropagation_preventDefault.png</a>
โฆ the parts thereof gleaned via a combination of user interactive HTML input textbox values and PHP dirname(__FILE__) and Linux awk space delimiter arguments and Linux find data and Linux file data and Linux sed โxโ inclusions and Linux sed edits (within as well, regarding those file and awk โreplace with find occurrenceโ usages, but others override).
Previous relevant PHP ImageMagick Image Dimensions Sort Tutorial is shown below.
Itโs natural for people to try to introduce order into their world. No matter what you think of the goings on in the world, you can โretireโ into that โcushioned worldโ of I.T. and create your own order. The most common form of โorderโ used, we dare to guess, in the I.T. world is to sort data. Our data we started with yesterdayโs PHP ImageMagick Image Dimensions Primer Tutorial in the form of image URLs and their dimensions (plus some other fields) presented in a table are a case in point where a lot of people would be quick to point out โthat it would be good to sort by widthโ and those who would โdo a triple pike with a double somersault to see data sorted by heightโ.
If you are in charge of the data that forms your data, that is easy to arrange. But if you are the โsecond sourceโ you need to work out your own ways to manipulate the data to be able to sort it usefully. We found these manipulations still only had to call on โฆ
- awk # command line processor repeats column field data
- sed # command line editor most associated with pipe commands
โฆ with the focus, today, on awkโs String functionality โฆ
โฆ preparing the ground for the Linux command โฆ
- sort # sort with its -k -t -n -r switches
โฆ enabling the useful sorting of image URL filespec data presented in a table โฆ order indeed!
You can retry this out for yourself at todayโs liverun link with its underlying serverside PHP code you could call image_dimensions
php and changed in thisway as you wish.
Previous relevant PHP ImageMagick Image Dimensions Primer Tutorial is shown below.
We revisit the talents of the brilliant ImageMagickโ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 โฆ
identify [webServerImageFileSpec]
โฆ sums up what we build a web application around, having a PHP shell use its exec method to filter the information through (Linux command line) โฆ
- awk # command line processor repeats column field data
- sed # command line editor most associated with pipe commands
โฆ to result in the table contents of our image (specification) table in our web application today.
You can try this out for yourself at todayโs liverun link with its underlying serverside PHP code you could call image_dimensions
php as you wish.
Previous relevant Location Services iPad Camera Geolocation Png Metadata Tutorial is shown below.
Todayโs โfoot further into the waterโ progress building on Location Services iPad Camera Geolocation Jpeg Exif Tutorial, as shown below, has a posting title that includes the word โGeolocationโ, but alas, weโ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โs Location Services iPad Camera Geolocation Png Metadata Tutorial. However, there are other interesting pieces of information regarding an image that donโt involve the โwhereโ of life, and so we find this topic interesting even so, and hope you do too.
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 โฆ
- ImageMagick command line functionality via โidentifyโ command
- Imagick class in PHP
- ExifTool third party solution in Perl
โฆ 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.
We leave you with the reworked read_exif_off_image_rotatephp, changed thisway, that has this corresponding new live
run.
Previous relevant Location Services iPad Camera Geolocation Jpeg Exif Tutorial is shown below.
Maybe you were here when we left off with Location Services iPad Camera Geolocation Primer Tutorial as shown below โฆ
- amazed at the power of mobile devices, specifically an iPad, with their Camera apps and Geolocation data โฆ and/or โฆ
- not knowing enough โฆ and still not โฆ about when the iPad chooses to output the photograph in *.PNG or *.JPG โฆ ie. the blurb below about meta data versus exif data โฆ and โฆ
- vowing to be like Fu Manchu โฆ so here we are
Okay, you might want to read more about that iPad decision regarding *.PNG versus *.JPG, and you may want to start here, but in any case, with our fish photographs from that day we got a mix of โฆ
- JPG
- PNG
โฆ and as far as teeing into Geolocation (or Geotagging) data goes we, so far, much prefer JPG, because we can use PHP exif methods, and todayโs tutorial is about that, building on what we did at PHP Exif Image Information Rotation Tutorial. As far as the PNG photos go โฆ well, thereโs more to do regarding metadata considerations, and we havenโt given up on that โฆ but that is for another day. In the meantime, enjoy the reworked read_exif_off_image_rotatephp, changed thisway, that has this corresponding new live
run link to show that GPS data we havenโt seen up until the fish photographs, and interpreting the exif data now, means we can display a Google Chart Map Chart โฆ
โฆ showing the Geolocation context of where and when, and even how high up, this photograph was taken. Cute, huh?!
Previous relevant Location Services iPad Camera Geolocation Primer Tutorial is shown below.
We had occasion to read here about resetting Location Services on an iPad โฆ which, we need to say, youโd only read about and contemplate if something youโve done has stopped a Geolocation thing you wanted to happen to no longer happen and youโ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 Location Services iPad Battery Loss Issue Tutorial) โฆ and the result of doing this opened up the iPadโs Camera app for permission for Location Services to record Geolocation data, and it looks like, time, information on the photographs you take. We also explore this subject at WordPress 4.1.1โs Location Services iPad Camera Geolocation Primer Tutorial. Presumably, this happens in the photographโs exif data, perhaps (am not promising, might pan out to be metadata) โฆ which interests us as well, and weโll go into that more soon.
So we used this functionality, as well as zooming in on some fish in our pond for todayโs digital photography sojourn. Maybe seeing fish is a source of mindfulness โฆ
โฆ for you, as it seems to help for me?
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.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.