Todayโs blog posting titular (and main) message is really a tip to those Mac OS X users that enjoy command line work, via the Terminal (desktop) application. Do you waste a fair bit of time using the cd command to navigate your way to various software projects, or the like? Around here, we tend to use Mac OS X Terminal command line a lot, but get around too much use of cd by letting (the fragrant aroma and sea breezes of) MAMP local Apache/PHP/MySql web server (wash over the very essence of our being). Even delving into the woooooorrrrrllllldddds of node.js or MeteorJS or Backbone.js or AngularJS or ReactJS our first instinct would be to work off MAMPโs /Application/MAMP/htdocs/ (document root) because we sort of โlive MAMPโ and โhang about with MAMPโ (you had to be there), and so, find things later, to remember, as a result, and also, we baulk from those great long cd commands, as we are here today to outline another approach to all this.
- Half fill your Mac OS X screen with a Terminal session, perhaps at the left.
- Fill the other right half with a Mac OS X Finder window.
- Try typing a blank character appended to cd on the Terminal session โฆ ie. โcd โ
- In the Finder session, drag a folder over to the Terminal session to the right of the โcd โ typing, and drop.
- In the Terminal session complete the command via an Enter key press.
Get it?! Cute, huh?! Okay, thatโs the end of todayโs blog postingโs main thought.
If you are not interested in the โMaking Of โฆโ thoughts you are excused now.
We were wondering how to present this concept. At first we thought a single image. No, it needs an action, and consequence, to be apt with todayโs subject matter (ie. to segment the single image could be done, but would not simulate the โdrag and dropโ action feeling). What about a PDF Slideshow? Thatโs good for covering the action, and consequence, but not for setting it off without user intervention, which may never happen. So, in that case, what about an Animated GIF, homegrown (ie. where size can be bigger than with the redoubtable Gifpal animated GIF creator, for millions)? Yes, more the go, we think. And that got us back into the woooooorrrrrrlllllddd of Animated GIF and Video via PHP Writing PHP Data URI Tutorial and all its presentation styles, which we wanted to show you.
- we start with the titular animated GIF โฆ
- then thereโs the data URI animated GIF โฆ
- then thereโs the ffmpeg created (stop and wait to be controlled) video idea โฆ
- then thereโs the ffmpeg created (attempt to autoplay (and loop), given there is no audio, though many platforms disallow this idea) video idea โฆ
- then thereโs the animated GIF about this โMaking Of โฆโ work with โฆ
Files work as well as folders. Supposing wherever we see cd above you substitute in your mind the command line editor vi and wherever we talked about folder above you substitute in ascii text file, that could work too. We hope you are left with ideas.
Previous relevant Animated GIF and Video via PHP Writing PHP Data URI Tutorial is shown below.
There is a great open source command line application called โFFmpegโ that can create video (or convert video) from image slides (for instance), and so, if we merge functionality for this into yesterdayโs Animated GIF and Slideshow via PHP Writing PHP Data URI Tutorial some โpresentationโ styles that our webapplication can process are now โฆ
- animated GIF
- slideshow
- video
As useful as โFFmpegโ is, it is not necessarily a default application existing on web server operating systems like our rjmprogramming.com.auโs CentOS server. But we do have it on our Mac OS X (MacBook Pro) operating systemโs command line, so we write our PHP determining whether to โฆ
- create the video data there and then via โFFmpegโ and PHPโs exec method โฆ or โฆ
- provide instructions to be able to create the video back at your client computer (that has โFFmpegโ perhaps) โฆ to suit the โฆ
ffmpeg -r 1 -i %03d.jpg video.mp4
โฆ to create a video called video.mp4 with 1 second delays between (input) slides named 001.jpg then 002.jpg then 003.jpg etcetera โฆ thanks useful webpage for the help โฆ that in the command line can sometimes be played via โฆ
open video.mp4
โฆ or used in some HTML as per โฆ
<video controls id=ivideo type='video/mp4'><source src='video.mp4'></source></video>
โฆ that we show you, below, the Mac OS X local MAMP (Apache/PHP/MySql) web server running of todayโs PHP to create โฆ
If you are a regular at this blog and โFFmpegโ sounds a bit familiar to you, thatโs probably because youโve read FFmpeg Image Optimization Primer Tutorial on an earlier occasion โฆ by candlelight โฆ with the lights dimmed?!
See this in the context of how this PHP tutorial_to_animated_gifphp code changed for videos in thisway or try it as a live
run.
Previous relevant Animated GIF and Slideshow via PHP Writing PHP Data URI Tutorial is shown below.
To us, there are great similarities between animated GIFs and slideshows, as two forms of โpresentationโ, and so to extend yesterdayโs Animated GIF via PHP Writing PHP Data URI Tutorial animated GIF creator โPHP Writes PHPโ web application that now has the option for data URI โexportsโ we add the functionality for โฆ
- slideshow creation (using our inhouse methods) which defaults to a horizontal (hashtag type of) navigation โฆ as well as adding a โฆ
- slideshow creation, with Data URI image data, using functionality as if CSS z-index (ie. slides stacked on top of each other in โoverlayโ style) was being used, but actually isnโt โฆ
โฆ that little bit different to another โstackedโ (or z-index feeling) approach we talked about with Multiple Class Slideshow Details Tutorial, where HTML element โclassโ properties were changed so that the last class defined reflects the look of the slideshow slide desired at any given time. We just use an array, and a setTimeout timer to achieve the same ends today, with our work (or โpresentationโ). If this โhorizontal versus stackโ navigation choice interests you, also take a read of HTML Input Element Types Randomized History Tutorial.
Again, with all this added functionality, because it is โhostedโ in an HTML iframe element all the existant web browser (Windows right click or Mac OS X two finger gesture) functionality can come into play, and make life quite interesting for your non-mobile users โcollectingโ data URIs โฆ there are worse hobbies!
You can see this in the context of how this PHP tutorial_to_animated_gifphp code changed for slideshows in thisway or try it as a live
run.
Previous relevant Animated GIF via PHP Writing PHP Data URI Tutorial is shown below.
The previous relevant โPHP writes PHPโ methodology animated GIF creator we talked about, first, with Animated GIF via PHP Writing PHP Primer Tutorial came back to mind yesterday with our Missing Javascript Audio on Unmute Tutorial, where we pondered on whether an animated GIF could be represented on a webpage by a data URI. Why take an interest in this? Data URIs are very important to do with โฆ
- future mobile development web form navigation benefits from their usage
- the use of data URIs make your web pages independent of web server location issues, so make your web data more portable, and flexible
โฆ and ideally, animated GIFs are also not just a decorative part of all this web application usage (as they can be a very efficient representation of an animation that could not be a more succinct way to show that animation or presentation), and if they can be made to be like any other GIF or image data file in the ways they can be represented (and used), then that is all for the good.
So we changed the Jeroen van Wissenโs inspired PHP (โPHP writes PHPโ methodology) code tutorial_to_animated_gifphp code allow for this extra animated GIF data URI representation in a new additional HTML iframe (containing the animegif.html of code below) that when harnessing existant web browser (Windows right click or Mac OS X two finger gesture) functionality can glean for us, as required, that animated GIFโs data URI representation. But donโt get too excited about this being rocket science, in that with a bit of effort, and PHP, it could have been gleaned from what we already produced, in that (in PHP โlandโ) โฆ
$lastbitto="\$fp = fopen('animegif.gif', 'w');
\$data = \$gif->GetAnimation();
\$dataUri = 'data:image/gif;base64,' . base64_encode(\$data);
fwrite(\$fp, \$data);
fclose(\$fp);
\$fp = fopen('animegif.html', 'w');
fwrite(\$fp, '<!doctype html><html><body><h1>Data URI version below<h1><br><h4> ... via web browser (Windows right click, Mac OS X two finger gesture ...</h4><br><img src=' . \"\\n\" . \$dataUri . \"\\n\" . ' title=DataURI></img></body></html>');
fclose(\$fp);";
You can see this in the context of how this PHP code changed in thisway or try it as a liverun.
Previous relevant Animated GIF via PHP Writing PHP Primer Tutorial is shown below.
We find another very useful reason for PHP to write PHP. Today we establish a PHP web application to dynamically create Animated GIF images via some still images, like Gifpal would do.
We have some great open source PHP code to thank for the basis of the functionality we found at Jeroen van Wissenโs very useful link, thanks.
Then we added a more user friendly interface to get the information off the user we need. We present this in an HTML form, which navigates to the same PHP to do the actual assembly of the Animated GIF via techniques where PHP writes PHP โฆ and really needs to, to be useful.
Do you remember, last, when we did some PHP writing PHP functionality โฆ PHP Writes PHP Vertical TextBoxes Primer Tutorial?
And inside the PHP it makes big use of the GD and Image Functions to read and write the image data we assemble via the user information.
This Animated GIF form of animation is the easiest to implement, as it consists of just the one GIF image file, but the user has very little control over the animation settings, such as the delay between stills, one of the settings we ask about in our web application.
Our PHP source code today you could call tutorial_to_animated_gifphp and we redirect you to some live run ideas โฆ
- normal run with HTML form which posts back to itself โฆ live
run
- example GET parameters run (like our tutorial picture)
Hope you find this tutorial useful.
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.