{"id":58897,"date":"2023-04-09T03:01:34","date_gmt":"2023-04-08T17:01:34","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=58897"},"modified":"2023-04-08T14:13:33","modified_gmt":"2023-04-08T04:13:33","slug":"pdfimages-pdf-image-extraction-php-browsing-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/pdfimages-pdf-image-extraction-php-browsing-tutorial\/","title":{"rendered":"Pdfimages PDF Image Extraction PHP Browsing Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Pdfimages PDF Image Extraction PHP Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages_more.gif\" title=\"Pdfimages PDF Image Extraction PHP Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Pdfimages PDF Image Extraction PHP Browsing Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='Pdfimages PDF Image Extraction PHP Tutorial' href='#ppdfiephpt'>Pdfimages PDF Image Extraction PHP Tutorial<\/a> &#8230;<\/p>\n<ul>\n<li>asked a lot of the user as far as interactive entry goes having to specify &#8230;\n<ol>\n<li>input PDF file path<\/li>\n<li>input PDF file name<\/li>\n<\/ol>\n<\/li>\n<li>when, in this day and age with the HTML5 and the <a target=_blank title='Great link' href='http:\/\/www.html5rocks.com\/en\/tutorials\/file\/dndfiles\/'>File API<\/a> we can browse for that PDF file using a look like those dialogue boxes from the early Windows and Mac OS X desktop application days<\/li>\n<\/ul>\n<p>We don&#8217;t reinvent the wheel here, but <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.html----------------------GETME\">tweak<\/a> our oft-changed inhouse <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.html----------------------GETME\">client_browsing.htm<\/a> (which we&#8217;d like you to download to your <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server HTMLCSS folder, you create, off its document root) <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.htm\">interfacing<\/a> to the <a target=_blank title='Great link' href='http:\/\/www.html5rocks.com\/en\/tutorials\/file\/dndfiles\/'>File API<\/a>, allowing the interface, within the parent window nested in an iframe element, return &#8230;<\/p>\n<ol>\n<li>file <font size=1>base<\/font> name<\/li>\n<li>file size<\/li>\n<\/ol>\n<p> &#8230; not pushing any barrows chasing the non-generic file path data members available on a rare platform (to fill in our input PDF file path), instead, writing some PHP to try to glean that input PDF file path ourselves, knowing the two pieces of information above &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\nfunction rsearch($folder, $pattern, $size) { \/\/ thanks, anyway, to https:\/\/stackoverflow.com\/questions\/17160696\/php-glob-scan-in-subfolders-for-a-file<br \/>\n    $didea='';<br \/>\n    if (PHP_OS == \"Darwin\") {<br \/>\n      \/\/file_put_contents(\"x.ksh\", \"find \" . $folder . \" -type f -name \\\"\" . $pattern . \"\\\" 2&gt; \/dev\/null -exec wc -c {} + | egrep '^ \" . $size . \" ' | sed '\/ \" . $size . \" \/s\/\/\/g'\");<br \/>\n      if ($folder == DIRECTORY_SEPARATOR) {<br \/>\n        $didea=shell_exec(\"find \\$HOME\/Downloads -type f -name \\\"\" . $pattern . \"\\\" 2&gt; \/dev\/null -exec wc -c {} + | egrep '^ \" . $size . \" ' | sed '\/ \" . $size . \" \/s\/\/\/g'\");<br \/>\n      \/\/file_put_contents(\"xx.ksh\", $didea);<br \/>\n        if ($didea != '') { return $didea; }<br \/>\n        $didea=shell_exec(\"find \" . dirname(__FILE__) . DIRECTORY_SEPARATOR  . \" -type f -name \\\"\" . $pattern . \"\\\" 2&gt; \/dev\/null -exec wc -c {} + | egrep '^ \" . $size . \" ' | sed '\/ \" . $size . \" \/s\/\/\/g'\");<br \/>\n      \/\/file_put_contents(\"xxx.ksh\", $didea);<br \/>\n        if ($didea != '') { return $didea; }<br \/>\n      }<br \/>\n      return shell_exec(\"find \" . $folder . \" -type f -name \\\"\" . $pattern . \"\\\" 2&gt; \/dev\/null -exec wc -c {} + | egrep '^ \" . $size . \" ' | sed '\/ \" . $size . \" \/s\/\/\/g'\");<br \/>\n    }<br \/>\n    \/\/$iti = new RecursiveDirectoryIterator($folder);<br \/>\n    \/\/foreach (new RecursiveIteratorIterator($iti) as $file) {<br \/>\n    \/\/foreach (glob($folder . $pattern) as $file) {<br \/>\n    \/\/     if (strpos($file , $pattern) !== false && filesize($file) == $size) {<br \/>\n    \/\/        return $file;<br \/>\n    \/\/     }<br \/>\n    \/\/}<br \/>\n    return '';<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p> &#8230; so far just for Mac OS X or macOS &#8230; sorrrryyyyy!<\/p>\n<p>Along the way, we now offer, as far as image displays go, the choices of &#8230;<\/p>\n<ul>\n<li>images from left to right (as with yesterday) &#8230; and now &#8230;<\/li>\n<li>images from top to bottom<\/li>\n<li>images that fill screen width, as far as they can fit<\/li>\n<\/ul>\n<p>The images can be clicked to open individually in new web browser tabs, should that interest.<\/p>\n<p>So, why not download <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php-GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php-GETME\">php_calls_pdfimages.php<\/a> <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server&#8217;s document root ( ie. using a MAMP macOS URL HTTP:\/\/localhost:8888\/php_calls_pdfimages.php and may take you there with <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php\">this public domain RJM Programming link<\/a> if all of above holds ).<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdfimages-pdf-image-extraction-php-browsing-tutorial\/'>Pdfimages PDF Image Extraction PHP Browsing Tutorial<\/a>.<\/p-->\n<hr>\n<p id='ppdfiephpt'>Previous relevant <a target=_blank title='Pdfimages PDF Image Extraction PHP Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdfimages-pdf-image-extraction-php-tutorial\/'>Pdfimages PDF Image Extraction PHP 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\/php_calls_pdfimages.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Pdfimages PDF Image Extraction PHP Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.gif\" title=\"Pdfimages PDF Image Extraction PHP Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Pdfimages PDF Image Extraction PHP Tutorial<\/p><\/div>\n<p>Today we&#8217;re building on yesterday&#8217;s <a title='Pdfimages PDF Image Extraction Primer Tutorial' href='#ppdfiept'>Pdfimages PDF Image Extraction Primer Tutorial<\/a>&#8216;s &#8230;<\/p>\n<ul>\n<li>macOS command line use of <a target=_blank title='Install Pdfimages to macOS, thanks' href='https:\/\/apple.stackexchange.com\/questions\/237371\/how-to-install-pdfimages-in-el-capitan'>thanks<\/a>, that the great <a target=_blank title=Pdfimages href='https:\/\/www.cyberciti.biz\/faq\/easily-extract-images-from-pdf-file\/'>Pdfimages<\/a> suite of software works in to extract the images contained within a PDF &#8230; by allowing &#8230;<\/li>\n<li>a combination of &#8230;\n<ul>\n<li>macOS<\/li>\n<li><a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server<\/li>\n<li>inhouse PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php_GETME\">php_calls_pdfimages.php<\/a> downloaded to document root of MAMP web server<\/li>\n<li>PHP <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'>exec<\/a><\/li>\n<\/ul>\n<p> &#8230; can present a form a MAMP webpage user uses to find the input PDF and suggest a prefixing part to the filenames, which will end up creating images from that PDF file as per &#8230; [userPrefix]-0.jpg [userPrefix]-1.jpg [userPrefix]-2.jpg etcetera etcetera etcetera\n<\/li>\n<\/ul>\n<p>So here&#8217;s our source code for <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php_GETME\">php_calls_pdfimages.php<\/a> as it sits for this first incarnation ( ie. using a MAMP macOS URL HTTP:\/\/localhost:8888\/php_calls_pdfimages.php and may take you there with <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/php_calls_pdfimages.php\">this public domain RJM Programming link<\/a> if all of above holds ).<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdfimages-pdf-image-extraction-php-tutorial\/'>Pdfimages PDF Image Extraction PHP Tutorial<\/a>.<\/p-->\n<hr>\n<p id='ppdfiept'>Previous relevant <a target=_blank title='Pdfimages PDF Image Extraction Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdfimages-pdf-image-extraction-primer-tutorial\/'>Pdfimages PDF Image Extraction 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\/Mac\/pdfimages_install.gif\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Pdfimages PDF Image Extraction Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/pdfimages_install.gif\" title=\"Pdfimages PDF Image Extraction Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Pdfimages PDF Image Extraction Primer Tutorial<\/p><\/div>\n<p>When we presented <a title='PDF via Slide Images and Back Again via ImageMagick Primer Tutorial' href='#pdfsibaimpt'>PDF via Slide Images and Back Again via ImageMagick Primer Tutorial<\/a> we referenced &#8230;<\/p>\n<ul>\n<li>the great ImageMagick suite of software capable of extracting PDF pages as an image &#8230; as distinct from our curiosity today &#8230;<\/li>\n<li>we <a target=_blank title='Pdfimages rather than ImageMagick, thanks' href='https:\/\/imagemagick.org\/discourse-server\/viewtopic.php?t=35309'>discovered<\/a>, <a target=_blank title='Install Pdfimages to macOS, thanks' href='https:\/\/apple.stackexchange.com\/questions\/237371\/how-to-install-pdfimages-in-el-capitan'>thanks<\/a>, that the great <a target=_blank title=Pdfimages href='https:\/\/www.cyberciti.biz\/faq\/easily-extract-images-from-pdf-file\/'>Pdfimages<\/a> suite of software can extract the images contained within a PDF<\/li>\n<\/ul>\n<p>And so, today, we show with today&#8217;s animated GIF presentation<\/a> &#8230;<\/p>\n<ul>\n<li>installing Pdfimages on macOS via &#8230;<br \/>\n<code><br \/>\nbrew install poppler<br \/>\n<\/code>\n<\/li>\n<li>using a macOS command line (via Terminal application) issued command &#8230;<br \/>\n<code><br \/>\npdfimages -j \"September 22 record.pdf\" ideas -png<br \/>\n<\/code><br \/>\n &#8230; to extract the 242 images (curiously, as jpeg images) contained within our input PDF.\n<\/li>\n<\/ul>\n<p>Interesting, huh?<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdfimages-pdf-image-extraction-primer-tutorial\/'>Pdfimages PDF Image Extraction Primer Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdfsibaimpt'>Previous relevant <a target=_blank title='PDF via Slide Images and Back Again via ImageMagick Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-via-slide-images-and-back-again-via-imagemagick-primer-tutorial\/'>PDF via Slide Images and Back Again via ImageMagick 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\/Mac\/ants_pdf.pdf\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF via Slide Images and Back Again via ImageMagick Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ants_pdf.jpg\" title=\"PDF via Slide Images and Back Again via ImageMagick Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PDF via Slide Images and Back Again via ImageMagick Primer Tutorial<\/p><\/div>\n<p>Does today&#8217;s blog posting title sound familiar to you?  If so, I&#8217;m impressed.  If not, get the whole picture, in context (we hope), today of &#8230;<\/li>\n<ul>\n<li>today&#8217;s &#8220;PDF via Slide Images and Back Again via ImageMagick Primer Tutorial&#8221; &#8230; gets its cues from a &#8230;<\/li>\n<li>previous &#8220;Video via Slide Images and Back Again via ffmpeg Primer Tutorial&#8221; &#8230; so that &#8230;\n<ol>\n<li>PDF is the output file format as distinct from a Video Format such as *.mov or *.mp4<\/li>\n<li><a target=_blank title='ImageMagick software suite' href='https:\/\/www.imagemagick.org\/'>ImageMagick<\/a> is the conduit to that work as distinct from <a target=_blank title='ffmpeg' href='https:\/\/www.ffmpeg.org\/'>ffmpeg<\/a><\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p> &#8230; and that what is a common denominator here to be able to convert between Video and PDF and vice versa, is a set of image slides (or frames) of the animation concerned, today&#8217;s being, again, that Ant Video we took on our iPhone (that became the &#8220;Star Ant Video&#8221;), and that today takes as its <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ants_pdf.pdf\" title=\"Click picture\">starting point<\/a> &#8230;<\/p>\n<ol>\n<li>image slides (or frames) from <a title='Video via Slide Images and Back Again via ffmpeg Primer Tutorial' href='#vsibapt'>Video via Slide Images and Back Again via ffmpeg Primer Tutorial<\/a> our MacBook Pro (via an email attachment download) &#8230; a listing of which looks like &#8230;<br \/>\n<code><br \/>\n$ ls -l image-000*.jpeg<br \/>\n-rw-r--r--  1 user  admin  170993 26 Jul 11:20 image-0001.jpeg<br \/>\n-rw-r--r--  1 user  admin  205565 26 Jul 11:20 image-0002.jpeg<br \/>\n-rw-r--r--  1 user  admin  218950 26 Jul 11:20 image-0003.jpeg<br \/>\n-rw-r--r--  1 user  admin  164271 26 Jul 11:20 image-0004.jpeg<br \/>\n-rw-r--r--  1 user  admin  171662 26 Jul 11:20 image-0005.jpeg<br \/>\n-rw-r--r--  1 user  admin  155528 26 Jul 11:20 image-0006.jpeg<br \/>\n-rw-r--r--  1 user  admin   53193 26 Jul 11:20 image-0007.jpeg<br \/>\n<\/code>\n<\/li>\n<li>gets converted to an original (input) PDF (<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/antsoriginal.pdf\">antsoriginal.pdf<\/a>) (with slideshow capabilities via applications like Mac OS X&#8217;s Preview or Adobe Acrobat Reader) via Mac OS X Terminal application command line&#8217;s ImageMagick executable convert command &#8230;<br \/>\n<code><br \/>\nconvert image-000*.jpeg -density 4096 antsoriginal.pdf<br \/>\n<\/code><br \/>\n &#8230; and then we act as though this PDF was our original source of data and decide to &#8230;<\/li>\n<li>break that PDF into its constituent image slides (or frames) via &#8230;<br \/>\n<code><br \/>\nconvert -density 900 antsoriginal.pdf image_pdf.jpeg<br \/>\n<\/code><br \/>\n &#8230; and then use ImageMagick convert commands again to &#8230;<\/li>\n<li>crop those image slides via Mac OS X Terminal application command line&#8217;s ImageMagick executable convert commands (thanks to this <a target=_blank title='Great advice, thanks' href='https:\/\/hackernoon.com\/save-time-by-transforming-images-in-the-command-line-c63c83e53b17'>great advice<\/a>) &#8230;<br \/>\n<code><br \/>\n$ convert image_pdf-0.jpeg  -crop 3000x6000+4000+4000 -gravity center image_pdf-0.jpg<br \/>\n$ convert image_pdf-1.jpeg  -crop 3000x6000+4000+4000 -gravity center image_pdf-1.jpg<br \/>\n$ convert image_pdf-2.jpeg  -crop 3000x6000+4000+4000 -gravity center image_pdf-2.jpg<br \/>\n$ convert image_pdf-3.jpeg  -crop 3000x6000+4000+4000 -gravity center image_pdf-3.jpg<br \/>\n$ convert image_pdf-4.jpeg  -crop 3000x6000+4000+4000 -gravity center image_pdf-4.jpg<br \/>\n$ convert image_pdf-5.jpeg  -crop 3000x6000+4000+4000 -gravity center image_pdf-5.jpg<br \/>\n$ convert image_pdf-6.jpeg  -crop 3000x6000+4000+4000 -gravity center image_pdf-6.jpg<br \/>\n<\/code><br \/>\n &#8230; into new PDF slide images (or frames) that can be converted to (output) PDF (<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/antscentral.pdf\">antscentral.pdf<\/a>) via ImageMagick executable convert command &#8230;<br \/>\n<code><br \/>\nconvert image_pdf*.jpg antscentral.pdf<br \/>\n<\/code><br \/>\n &#8230; to see &#8230;<\/li>\n<li>we end up with the (relevant) file listing &#8230;<br \/>\n<code><br \/>\n$ ls -l image-000*.jpeg image_pdf*.jp*g ants*l.pdf<br \/>\n-rw-r--r--@ 1 user  admin  17405330 15 Aug 12:00 antscentral.pdf<br \/>\n-rw-r--r--@ 1 user  admin   1350686 15 Aug 11:53 antsoriginal.pdf<br \/>\n-rw-r--r--  1 user  admin    170993 26 Jul 11:20 image-0001.jpeg<br \/>\n-rw-r--r--  1 user  admin    205565 26 Jul 11:20 image-0002.jpeg<br \/>\n-rw-r--r--  1 user  admin    218950 26 Jul 11:20 image-0003.jpeg<br \/>\n-rw-r--r--  1 user  admin    164271 26 Jul 11:20 image-0004.jpeg<br \/>\n-rw-r--r--  1 user  admin    171662 26 Jul 11:20 image-0005.jpeg<br \/>\n-rw-r--r--  1 user  admin    155528 26 Jul 11:20 image-0006.jpeg<br \/>\n-rw-r--r--  1 user  admin     53193 26 Jul 11:20 image-0007.jpeg<br \/>\n-rw-r--r--  1 user  admin  17643304 15 Aug 11:18 image_pdf-0.jpeg<br \/>\n-rw-r--r--  1 user  admin   2906716 15 Aug 11:56 image_pdf-0.jpg<br \/>\n-rw-r--r--  1 user  admin  18521373 15 Aug 11:18 image_pdf-1.jpeg<br \/>\n-rw-r--r--  1 user  admin   3022841 15 Aug 11:58 image_pdf-1.jpg<br \/>\n-rw-r--r--  1 user  admin  17394312 15 Aug 11:18 image_pdf-2.jpeg<br \/>\n-rw-r--r--  1 user  admin   2762837 15 Aug 11:58 image_pdf-2.jpg<br \/>\n-rw-r--r--  1 user  admin  13963420 15 Aug 11:19 image_pdf-3.jpeg<br \/>\n-rw-r--r--  1 user  admin   2215533 15 Aug 11:58 image_pdf-3.jpg<br \/>\n-rw-r--r--  1 user  admin  16076730 15 Aug 11:19 image_pdf-4.jpeg<br \/>\n-rw-r--r--  1 user  admin   2597147 15 Aug 11:59 image_pdf-4.jpg<br \/>\n-rw-r--r--  1 user  admin  16544272 15 Aug 11:19 image_pdf-5.jpeg<br \/>\n-rw-r--r--  1 user  admin   2840288 15 Aug 11:59 image_pdf-5.jpg<br \/>\n-rw-r--r--  1 user  admin   6870989 15 Aug 11:19 image_pdf-6.jpeg<br \/>\n-rw-r--r--  1 user  admin   1030314 15 Aug 11:59 image_pdf-6.jpg<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p>Just as we decided to reinstall ffmpeg due to that disk crash, we decided to reinstall ImageMagick to this MacBook Pro here, and found, thanks to <a target=_blank title='Great ImageMagick install advice' href='http:\/\/cactuslab.com\/imagemagick\/'>great advice<\/a>, we found that we needed to &#8230;<\/p>\n<ol>\n<li>install ImageMagick via that previous link&#8217;s relevant download link &#8230; then at Terminal application command line &#8230;<br \/>\n<code><br \/>\nsudo -k ln -s \/opt\/ImageMagick\/bin\/convert \/usr\/bin\/convert<br \/>\n<\/code>\n<\/li>\n<li>install GhostScript via that previous link&#8217;s relevant download link &#8230; then at Terminal application command line &#8230;<br \/>\n<code><br \/>\nsudo -k ln -s \/opt\/Ghostscript\/bin\/gs \/usr\/local\/bin\/gs<br \/>\n<\/code><br \/>\n<img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ants_pdf-imagemagick-ghostscript.jpg\" title=\"ants_pdf-imagemagick-ghostscript.jpg\" \/>\n<\/li>\n<li>install XQuartz via via <a target=_blank title='XQuartz download page' href='https:\/\/www.xquartz.org\/'>XQuartz download page<\/a>, thanks<\/li>\n<p><img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ants_pdf-imagemagick-ghostscript-xquartz.jpg\" title=\"ants_pdf-imagemagick-ghostscript.jpg\" \/>\n<\/ol>\n<p>All animations, different forms (or formats), all presentation facilitators, is the message here today.<\/p>\n<hr>\n<p id='vsibapt'>Previous relevant <a target=_blank title='Video via Slide Images and Back Again via ffmpeg Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/video-via-slide-images-and-back-again-via-ffmpeg-primer-tutorial\/'>Video via Slide Images and Back Again via ffmpeg 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\/Mac\/ants.pdf\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Video via Slide Images and Back Again via ffmpeg Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ants.jpg\" title=\"Video via Slide Images and Back Again via ffmpeg Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Video via Slide Images and Back Again via ffmpeg Primer Tutorial<\/p><\/div>\n<p>Reading yesterday&#8217;s <a target=_blank title='LibreOffice Spreadsheet via dBase Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/libreoffice-spreadsheet-via-dbase-primer-tutorial\/'>LibreOffice Spreadsheet via dBase Primer Tutorial<\/a> you can&#8217;t say I didn&#8217;t warn you about my interest in ants (and bees)?  Glad you asked?<\/p>\n<p><b><i>Did you know?<\/i><\/b><\/p>\n<ul>\n<li>the queen ant (often just one per ant colony) is not a leader as such in thinking out strategies &#8230; believe it or not &#8230;<\/li>\n<li>it is believed ant colony strategies are worked by what we might call &#8220;groupthink&#8221;<\/li>\n<li>ants march in line often and the scent that the ants leave behind is pheromone, that non-leader ants follow off that left behind by the &#8220;leader ant&#8221; &#8230; ie. &#8220;leader&#8221; of position, rather than &#8220;leader&#8221; of hierarchy<\/li>\n<\/ul>\n<p>So seeing some ants walking in line up a power pole, used an iPhone to capture a very short video (short enough to use the iPhone&#8217;s Photo app&#8217;s Share via Mail (attachment) method of emailing to the MacBook Pro, and then (<a target=_blank title='Gmail' href='http:\/\/gmail.com'>Gmail website<\/a>) downloading) of this, and later, buck the &#8220;ant&#8221; trend, and &#8220;anthropomorphise&#8221; a &#8220;star ant&#8221;, by honing in on an ant in this video and ring it (and its movement) before creating another &#8220;Star Ant Video&#8221;.<\/p>\n<p>There are video editing approaches you could use, but what got us interested was the thought of &#8230;<\/p>\n<ul>\n<li>break the video into its component parts &#8230; just like animations like <a target=_blank href='https:\/\/www.youtube.com\/watch?v=tJBeih6JZrs' title='?'>&#8220;Bugs Bunny&#8221;<\/a> &#8230; a series of (slide, or frame) images<\/li>\n<li>edit those (slide) images to add the (we&#8217;ve decided should be) red ringing of our &#8220;Star Ant&#8221; &#8230; who we&#8217;ve decided you, the user can call whatever you so desire &#8230; aaaaaaarrrrrrr<\/li>\n<li>reconstitute a new video from some new (slide) image components<\/li>\n<\/ul>\n<p>That&#8217;s where one of our favourite Mac Os X friendly media players, which is also a command line &#8220;player&#8221; (yayyyyyy!) comes to the fore, for us.  It&#8217;s the wonderful <a target=_blank title='ffmpeg' href='https:\/\/www.ffmpeg.org\/'>ffmpeg<\/a> which we&#8217;ve had for a long time now on this MacBook Pro until a disk crash mentioned some weeks back.  Could get it back off restore, but decided to reconsitute &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Xcode IDE information from Apple' href='https:\/\/developer.apple.com\/technologies\/tools\/'>Xcode<\/a> command line tools<\/li>\n<li><a target=_blank title='Homebrew as alternative to Package Manager' href='http:\/\/brew.sh\/'>Homebrew<\/a><\/li>\n<li>ffmpeg<\/li>\n<\/ul>\n<p> &#8230; as a fairly straightforward exercise (given you have Xcode installed already) via a <a target=_blank title='Ren\u00e9 Calles webpage' href='http:\/\/www.renevolution.com\/ffmpeg\/2013\/03\/16\/how-to-install-ffmpeg-on-mac-os-x.html'>How to install FFmpeg on Mac OS X<\/a> webpage by Ren\u00e9 Calles, thanks, heaps, we discovered the commands that worked well for us that go &#8230;<\/p>\n<p><code><br \/>\nruby -e \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)\"<br \/>\nbrew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools<br \/>\n<\/code><\/p>\n<p> &#8230; to (re)install ffmpeg so that, then &#8230;<\/p>\n<p><code><br \/>\nffmpeg -i IMG_0738.MOV -r 1 image-%04d.jpeg<br \/>\n<\/code><\/p>\n<p> &#8230; could create those original 7 (slide) images, though the use of a value bigger than <a target=_blank title='ffmpeg information' href='http:\/\/www.ffmpeg.org\/ffmpeg.html'>1<\/a> frames per second for the &#8220;-r&#8221; switch could be on the cards for your usages.<\/p>\n<p>How to edit those images?  We just used the Mac OS X version of <a target=_blank title='Paintbrush for Mac' href='http:\/\/paintbrush.sourceforge.net\/downloads\/'>PaintBrush<\/a> and lined a lot of these images side by side across the screen to try to track our &#8220;Star Ant&#8221; and award it the &#8220;Red Ellipse PaintBrush Order of Merit&#8221; (for individualism &#8230; tee hee).<\/p>\n<p>Reconstituting the new slides into a new video we remember was another talent of ffmpeg and found this <a target=_blank title='Useful webpage, thanks' href='https:\/\/stackoverflow.com\/questions\/24961127\/how-to-create-a-video-from-images-with-ffmpeg'>useful webpage<\/a>, thanks, on the topic of taking raw (slide) images to create a video via ffmpeg.  Actually, though, we also had our previous very useful <a target=_blank href='#agifvphpwphpdurit' title='Animated GIF and Video via PHP Writing PHP Data URI Tutorial'>Animated GIF and Video via PHP Writing PHP Data URI Tutorial<\/a> (presented below) to turn to to end up with the Mac OS X (Terminal session command line command &#8230;<\/p>\n<p><code><br \/>\nffmpeg -r 1 -i image-%04d.jpg ants.mp4<br \/>\n<\/code><\/p>\n<p>There are no worries with video file &#8220;workings&#8221; to do with uppercase and lowercase and names, so we &#8230;<\/p>\n<p><code><br \/>\ncp IMG_0738.MOV ants.mov<br \/>\n<\/code><\/p>\n<p> &#8230; just for some consistency purposes (and could use &#8220;mv&#8221; to rename instead) so that we can show you &#8230;<\/p>\n<table style=width:100%>\n<tr>\n<th>Before &#8230;<\/th>\n<th>After &#8230; &#8220;Star Ant Video&#8221;<\/th>\n<\/tr>\n<tr>\n<td><video controls type='video\/mp4' style='width:300px;'><source src='http:\/\/www.rjmprogramming.com.au\/Mac\/ants.mov'><\/source><\/video><\/td>\n<td><video controls type='video\/mp4' style='width:300px;'><source src='http:\/\/www.rjmprogramming.com.au\/Mac\/ants.mp4'><\/source><\/video><\/td>\n<\/tr>\n<\/table>\n<p>See a lot of all these goings on at today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/ants.pdf\" title=\"Click picture\">PDF slideshow<\/a>.<\/p>\n<hr>\n<p id='agifvphpwphpdurit'>Previous relevant <a target=_blank title='Animated GIF and Video via PHP Writing PHP Data URI Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/animated-gif-and-video-via-php-writing-php-data-uri-tutorial\/'>Animated GIF and Video via PHP Writing PHP Data URI 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\/animegif\/tutorial_to_animated_gif.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Animated GIF and Video via PHP Writing PHP Data URI Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/video_or_not.jpg\" title=\"Animated GIF and Video via PHP Writing PHP Data URI Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Animated GIF and Video via PHP Writing PHP Data URI Tutorial<\/p><\/div>\n<p>There is a great open source command line application called <a target=_blank title='FFmpeg' href='https:\/\/www.ffmpeg.org\/'>&#8220;FFmpeg&#8221;<\/a> that can create video (or convert video) from image slides (for instance), and so, if we <b>merge functionality for this<\/b> into yesterday&#8217;s <a title='Animated GIF and Slideshow via PHP Writing PHP Data URI Tutorial' href='#agifsphpwphpdurit'>Animated GIF and Slideshow via PHP Writing PHP Data URI Tutorial<\/a> some &#8220;presentation&#8221; styles that our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php\" title=\"Click picture\">web application<\/a> can process are now &#8230;<\/p>\n<ul>\n<li>animated GIF<\/li>\n<li>slideshow<\/li>\n<li><b>video<\/b><\/li>\n<\/ul>\n<p>As useful as &#8220;FFmpeg&#8221; is, it is not necessarily a default application existing on web server operating systems like our rjmprogramming.com.au&#8217;s CentOS server.  But we do have it on our Mac OS X (MacBook Pro) operating system&#8217;s command line, so we write our PHP determining whether to &#8230;<\/p>\n<ul>\n<li>create the video data there and then via &#8220;FFmpeg&#8221; and PHP&#8217;s <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'>exec<\/a> method &#8230; or &#8230;<\/li>\n<li>provide instructions to be able to create the video back at your client computer (that has &#8220;FFmpeg&#8221; perhaps) &#8230; to suit the &#8230;<br \/>\n<code><br \/>\nffmpeg -r 1 -i %03d.jpg video.mp4<br \/>\n<\/code><br \/>\n &#8230; to create a video called video.mp4 with 1 second delays between (input) slides named 001.jpg then 002.jpg then 003.jpg etcetera &#8230; thanks <a target=_blank title='Useful link' href='https:\/\/stackoverflow.com\/questions\/5892308\/create-video-file-using-php'>useful webpage<\/a> for the help &#8230; that in the command line can sometimes be played via &#8230;<br \/>\n<code><br \/>\nopen video.mp4<br \/>\n<\/code><br \/>\n &#8230; or used in some HTML as per &#8230;<br \/>\n<code><br \/>\n&lt;video controls id=ivideo type='video\/mp4'&gt;&lt;source src='video.mp4'&gt;&lt;\/source&gt;&lt;\/video&gt;<br \/>\n<\/code><br \/>\n &#8230; that we show you, below, the Mac OS X local <a target=_blank title='MAMP local Apache\/PHP\/MySql web server' href='http:\/\/mamp.info'>MAMP<\/a> (Apache\/PHP\/MySql) web server running of today&#8217;s PHP to create &#8230;<br \/>\n<video style='width:100%;' controls id=ivideo type='video\/mp4'><source src='http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/vid_eo.mp4'><\/source><\/video>\n<\/li>\n<\/ul>\n<p>If you are a regular at this blog and &#8220;FFmpeg&#8221; sounds a bit familiar to you, that&#8217;s probably because you&#8217;ve read <a target=_blank title='FFmpeg Image Optimization Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/ffmpeg-image-optimization-primer-tutorial\/'>FFmpeg Image Optimization Primer Tutorial<\/a> on an earlier occasion <font size=2>&#8230; by candlelight <\/font><font size=1>&#8230; with the lights dimmed?!<\/font><\/p>\n<p>See this in the context of how this PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php----GETME\" title=\"tutorial_to_animated_gif.php\">tutorial_to_animated_gif.php<\/a> code changed for videos in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php----GETME\">this way<\/a> or try it as a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php\" title=\"Click picture\">live run<\/a>.<\/p>\n<hr>\n<p id='agifsphpwphpdurit'>Previous relevant <a target=_blank title='Animated GIF and Slideshow via PHP Writing PHP Data URI Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/animated-gif-and-slideshow-via-php-writing-php-data-uri-tutorial\/'>Animated GIF and Slideshow via PHP Writing PHP Data URI 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\/animegif\/tutorial_to_animated_gif.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Animated GIF and Slideshow via PHP Writing PHP Data URI Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/agmore.jpg\" title=\"Animated GIF via PHP Writing PHP Data URI Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Animated GIF and Slideshow via PHP Writing PHP Data URI Tutorial<\/p><\/div>\n<p>To us, there are great similarities between animated GIFs and slideshows, as two forms of &#8220;presentation&#8221;, and so to extend yesterday&#8217;s <a title='Animated GIF via PHP Writing PHP Data URI Tutorial' href='#agifphpwphpdurit'>Animated GIF via PHP Writing PHP Data URI Tutorial<\/a> animated GIF creator &#8220;PHP Writes PHP&#8221; web application that now has the option for <a target=_blank title='Data URI information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Data_URI_scheme'>data URI<\/a> &#8220;exports&#8221; we add the functionality for &#8230;<\/p>\n<ul>\n<li>slideshow creation (using our inhouse methods) which defaults to a horizontal (hashtag type of) navigation &#8230; as well as adding a &#8230;<\/li>\n<li>slideshow creation, with Data URI image data, using functionality as if CSS <a target=_blank title='CSS z-index information from w3schools' href='http:\/\/www.w3schools.com\/cssref\/pr_pos_z-index.asp'>z-index<\/a> (ie. slides stacked on top of each other in <a target=_blank title='Overlay blog postings at this blog' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/overlay'>&#8220;overlay&#8221;<\/a> style) was being used, but actually isn&#8217;t &#8230;<\/li>\n<\/ul>\n<p> &#8230; that little bit different to another &#8220;stacked&#8221; (or z-index feeling) approach we talked about with <a target=_blank title='Multiple Class Slideshow Details Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/multiple-class-slideshow-details-tutorial\/'>Multiple Class Slideshow Details Tutorial<\/a>, where HTML element <a target=_blank title='HTML class information from w3schools' href='http:\/\/www.w3schools.com\/html\/html_classes.asp'>&#8220;class&#8221;<\/a> 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 <a target=_blank title='Javascript setTimeout() method information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/met_win_settimeout.asp'>setTimeout<\/a> timer to achieve the same ends today, with our work (or &#8220;presentation&#8221;).  If this &#8220;horizontal versus stack&#8221; navigation choice interests you, also take a read of <a target=_blank title='HTML Input Element Types Randomized History Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html-input-element-types-randomized-history-tutorial\/'>HTML Input Element Types Randomized History Tutorial<\/a>.<\/p>\n<p>Again, with all this added functionality, because it is &#8220;hosted&#8221; in an HTML <a target=_blank title='HTML iframe element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> 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 &#8220;collecting&#8221; data URIs <font size=1>&#8230; there are worse hobbies!<\/font><\/p>\n<p>You can see this in the context of how this PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php---GETME\" title=\"tutorial_to_animated_gif.php\">tutorial_to_animated_gif.php<\/a> code changed for slideshows in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php---GETME\">this way<\/a> or try it as a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php\" title=\"Click picture\">live run<\/a>.<\/p>\n<hr>\n<p id='agifphpwphpdurit'>Previous relevant <a target=_blank title='Animated GIF via PHP Writing PHP Data URI Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/animated-gif-via-php-writing-php-data-uri-tutorial\/'>Animated GIF via PHP Writing PHP Data URI 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\/animegif\/tutorial_to_animated_gif.php\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Animated GIF via PHP Writing PHP Data URI Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/animegif_datauri.jpg\" title=\"Animated GIF via PHP Writing PHP Data URI Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Animated GIF via PHP Writing PHP Data URI Tutorial<\/p><\/div>\n<p>The previous relevant &#8220;PHP writes PHP&#8221; methodology <a target=_blank title='Animated GIF information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/GIF'>animated GIF<\/a> creator we talked about, first, with <a title='Animated GIF via PHP Writing PHP Primer Tutorial' href='#agvpwppt'>Animated GIF via PHP Writing PHP Primer Tutorial<\/a> came back to mind yesterday with our <a target=_blank title='Missing Javascript Audio on Unmute Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/missing-javascript-audio-on-unmute-tutorial\/'>Missing Javascript Audio on Unmute Tutorial<\/a>, where we pondered on whether an animated GIF could be represented on a webpage by a <a target=_blank title='Data URI information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Data_URI_scheme'>data URI<\/a>.  Why take an interest in this?  Data URIs are very important to do with &#8230;<\/p>\n<ul>\n<li>future mobile development web form navigation benefits from their usage<\/li>\n<li>the use of data URIs make your web pages independent of web server location issues, so make your web data more portable, and flexible<\/li>\n<\/ul>\n<p> &#8230; 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.<\/p>\n<p>So we changed the Jeroen van Wissen&#8217;s <a target=_blank href='http:\/\/www.jeroenvanwissen.nl\/weblog\/php\/howto-generate-animated-gif-with-php' title='Great PHP library for Animated GIF creation work, thanks'>inspired<\/a> PHP (&#8220;PHP writes PHP&#8221; methodology) code <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php--GETME\">tutorial_to_animated_gif.php<\/a> 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&#8217;s data URI representation.  But don&#8217;t get too excited about this being rocket science, in that with a bit of effort, and PHP, it could have been gleaned <b>from what we already produced<\/b>, in that (in PHP &#8220;land&#8221;) &#8230;<\/p>\n<p><code><br \/>\n$lastbitto=\"\\$fp = fopen('animegif.gif', 'w');<br \/>\n\\$data = \\$gif->GetAnimation();<br \/>\n<b>\\$dataUri = 'data:image\/gif;base64,' . <a target=_blank title='PHP base64_encode information' href='http:\/\/php.net\/manual\/en\/function.base64-encode.php'>base64_encode<\/a>(\\$data);<\/b><br \/>\nfwrite(\\$fp, \\$data);<br \/>\nfclose(\\$fp);<br \/>\n<b>\\$fp = fopen('animegif.html', 'w');<br \/>\nfwrite(\\$fp, '&lt;!doctype html&gt;&lt;html&gt;&lt;body&gt;&lt;h1&gt;Data URI version below&lt;h1&gt;&lt;br&gt;&lt;h4&gt; ... via web browser (Windows right click, Mac OS X two finger gesture ...&lt;\/h4&gt;&lt;br&gt;&lt;img src=' . \\\"\\\\n\\\" . \\$dataUri . \\\"\\\\n\\\" . ' title=DataURI&gt;&lt;\/img&gt;&lt;\/body&gt;&lt;\/html&gt;');<br \/>\nfclose(\\$fp);\";<\/b><br \/>\n<\/code><\/p>\n<p>You can see this in the context of how this PHP code changed in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php--GETME\">this way<\/a> or try it as a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php\" title=\"Click picture\">live run<\/a>.<\/p>\n<hr>\n<p id='agvpwppt'>Previous relevant <a target=_blank title='Animated GIF via PHP Writing PHP Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/animated-gif-via-php-writing-php-primer-tutorial\/'>Animated GIF via PHP Writing PHP 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\/PHP\/animegif\/\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Animated GIF via PHP Writing PHP Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/animated_gif-186of.jpg\" title=\"Animated GIF via PHP Writing PHP Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Animated GIF via PHP Writing PHP Primer Tutorial<\/p><\/div>\n<p>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 <a target=_blank title='Gifpal' href='http:\/\/www.gifpal.com'>Gifpal<\/a> would do.<\/p>\n<p>We have some great open source PHP code to thank for the basis of the functionality we found at Jeroen van Wissen&#8217;s very <a target=_blank href='http:\/\/www.jeroenvanwissen.nl\/weblog\/php\/howto-generate-animated-gif-with-php'>useful link<\/a>, thanks.<\/p>\n<p>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 &#8230; and really needs to, to be useful.<\/p>\n<p>Do you remember, last, when we did some PHP writing PHP functionality &#8230; <a target=_blank title='PHP Writes PHP Vertical TextBoxes Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/php-writes-php-vertical-textboxes-primer-tutorial\/'>PHP Writes PHP Vertical TextBoxes Primer Tutorial<\/a>?<\/p>\n<p>And inside the PHP it makes big use of the <a target=_blank title='GD and Image Functions' href='http:\/\/php.net\/manual\/en\/ref.image.php'>GD and Image Functions<\/a> to read and write the image data we assemble via the user information.<\/p>\n<p>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.<\/p>\n<p>Our PHP source code today you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php_GETME\" title='tutorial_to_animated_gif.php'>tutorial_to_animated_gif.php<\/a> and we redirect you to some live run ideas &#8230;<\/p>\n<ul>\n<li>normal run with HTML form which posts back to itself &#8230; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php\" title='live run'>live run<\/a><\/li>\n<li>example GET parameters <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php?delay=500&#038;stitle=PaintBrush%20Panning%20Primer%20Tutorial&#038;slideshow=http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/index.html\" title='get parameters live run'>run<\/a> (like our tutorial picture)<\/li>\n<\/ul>\n<p>Hope you find this tutorial useful.<\/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='#d17197' onclick='var dv=document.getElementById(\"d17197\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/category\/animation\/\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d17197' 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='#d35097' onclick='var dv=document.getElementById(\"d35097\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/category\/animated-gif\/\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d35097' 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='#d35120' onclick='var dv=document.getElementById(\"d35120\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/slideshow\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d35120' 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='#d35146' onclick='var dv=document.getElementById(\"d35146\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/ffmpeg\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d35146' 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='#d39732' onclick='var dv=document.getElementById(\"d39732\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/video\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d39732' 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='#d40146' onclick='var dv=document.getElementById(\"d40146\"); dv.innerHTML = \"<iframe width=670 height=600 src=\" + \"\/\/www.rjmprogramming.com.au\/ITblog\/tag\/pdf\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d40146' 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='#d58880' onclick='var dv=document.getElementById(\"d58880\"); dv.innerHTML = \"<iframe width=670 height=600 src=\" + \"\/\/www.rjmprogramming.com.au\/ITblog\/tag\/command-line\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d58880' 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='#d58892' onclick='var dv=document.getElementById(\"d58892\"); dv.innerHTML = \"<iframe width=670 height=600 src=\" + \"\/\/www.rjmprogramming.com.au\/ITblog\/tag\/exec\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d58892' 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='#d58897' onclick='var dv=document.getElementById(\"d58897\"); dv.innerHTML = \"<iframe width=670 height=600 src=\" + \"\/\/www.rjmprogramming.com.au\/ITblog\/tag\/browse\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d58897' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday&#8217;s Pdfimages PDF Image Extraction PHP Tutorial &#8230; asked a lot of the user as far as interactive entry goes having to specify &#8230; input PDF file path input PDF file name when, in this day and age with the &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/pdfimages-pdf-image-extraction-php-browsing-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,14,33,37],"tags":[85,1993,3531,233,234,4307,341,405,2618,419,590,597,611,612,714,725,2178,744,885,913,4306,932,1252,1319],"class_list":["post-58897","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-software","category-tutorials","tag-apache","tag-browse","tag-browsing","tag-command","tag-command-line","tag-dektop-application","tag-display","tag-exec","tag-extract","tag-file-api","tag-image","tag-images","tag-install","tag-installation","tag-local-web-server","tag-mac-os-x","tag-macos","tag-mamp","tag-operating-system-2","tag-pdf","tag-pdfimages","tag-php","tag-terminal","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/58897"}],"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=58897"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/58897\/revisions"}],"predecessor-version":[{"id":58905,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/58897\/revisions\/58905"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=58897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=58897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=58897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}