Animated GIF Creator Overlayed Images Top Left Tutorial
โœ‚๐Ÿƒ๐Ÿพโ€โ™€๏ธ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ
๐Ÿ“–

Animated GIF Creator Overlayed Images Top Left Tutorial

Animated GIF Creator Overlayed Images Top Left Tutorial   ๐Ÿ”

To add to the recent Animated GIF Creator Overlayed Images Tutorialโ€˜s user interaction logic, we add a way to control those two โ€œoverlayโ€ CSS properties โ€ฆ

  • left
  • top

โ€ฆ but more in the sense that we allow CSS โ€ฆ

  • margin-eft
  • margin-top

โ€ฆ come into the picture, after a dalliance with CSS calc thoughts.

This allows for offsetted images be part of the โ€œoverlay mixโ€ that you can retry this at ourchanged tutorial_to_animated_gifโšซphp inhouse public domain Animated GIF Creator.



Previous relevant Animated GIF Creator Overlayed Images Tutorial is shown below.

Animated GIF Creator Overlayed Images Tutorial

Animated GIF Creator Overlayed Images Tutorial   ๐Ÿ”

We wanted to add an โ€œOverlayed Imagesโ€ functionality component to the โ€œAnimated GIF Creatorโ€ of Animated GIF Creator Video Intranet Tutorial, today.

The work involves both of the HTML design โ€œbig conceptsโ€ we are keen on at this blog โ€ฆ

  • overlay โ€ฆ via CSS control of โ€ฆ
    1. position:absolute;top:0px;left:0px;
    2. opacity:1.0;
    3. z-index:1;
  • reveal โ€ฆ lately, mostly, via HTML use of โ€ฆ
    1. details
    2. summary

โ€ฆ the latter being the โ€œcontainerโ€ for our interactive input be able to control overlay items 2 and 3, which affect the โ€œoverlayed imagesโ€ output display via the clicking of a new โ€œOverlay Imagesโ€ button. That button โ€ฆ



<input disabled onclick="overlaythem();" id="overlayit" type="button" title='Overlay Images' value='Overlay Images'></input>

โ€ฆ starts off as disabled โ€ฆ and works with new HTML div elements โ€ฆ



<div id=overlayedj><h1>&nbsp;</h1><br></div><div id=overlayedi></div>

โ€ฆ until at least two images are defined, at which time the button becomes enabled โ€ฆ



function onfit(ithis) {

if (ithis.value == '' && ('' + ithis.placeholder).indexOf(']') != -1) {

ithis.value=('' + ithis.placeholder).split('[')[1].split(']')[0];

}

ithis.type='number';

}



function overlayds(inm, newop, newzi) {

var outdets='';

var divrect=null;

var poslt=' data-style=\"position:absolute;left:px;top:px;\" ';

var reposit='';

if (!document.getElementById('detsum' + ('' + inm))) {

if (document.getElementById('overlayedi').innerHTML == '') {

document.getElementById('overlayedi').title='Overlayed Images Below ... Click for It in New Window ...';

document.getElementById('overlayedj').innerHTML='<h1>Overlayed Images Below ...</h1><br>';

divrect=document.getElementById('overlayedi').getBoundingClientRect();

poslt=' data-style=\"position:absolute;left:' + ('' + divrect.left).split('.')[0].trim() + 'px;top:' + ('' + eval(200 + eval('' + ('' + divrect.top).split('.')[0]))).trim() + 'px;\" ';

} else {

poslt=' data-style=\"' + document.getElementById('detsum1').getAttribute('data-style') + '\" ';

}

outdets='&nbsp;&nbsp;<details ' + poslt + ' id=\"detsum' + ('' + inm) + '\" style=\" display:inline-block; \" open><summary id=\"sumdet' + ('' + inm) + '\">Overlay</summary><input onchange=overlayds(' + inm + ',this.value,String.fromCharCode(32)); onblur=overlayds(' + inm + ',this.value,String.fromCharCode(32)); type=text onfocus=onfit(this); id=\"opacity' + ('' + inm) + '\" style=\" display:inline-block; \" placeholder=\"Opacity [1.00]\" value=\"\" step=0.01 min=0.00 max=1.00></input><br><input onfocus=onfit(this); onchange=overlayds(' + inm + ',String.fromCharCode(32),this.value); onblur=overlayds(' + inm + ',String.fromCharCode(32),this.value); type=text id=\"zindex' + ('' + inm) + '\" style=\" display:inline-block; \" placeholder=\"Z-Index [1]\" value=\"\" min==999 max=999 step=1></input><br></details>';

reposit=poslt.replace(' data-',' ');

reposit=reposit.replace('\"', '\"opacity:1.0;z-index:1;');

if (document.getElementById('overlayedi').innerHTML == '') {

document.getElementById('overlayedi').innerHTML='<img id=\"imgdet' + ('' + inm) + '\" src=\"' + document.getElementById('slideshow' + ('' + inm).replace(/^1$/g,'')).value + '\" ' + reposit + '></img>';

document.getElementById('overlayedi').style.width=('' + document.getElementById('imgdet' + ('' + inm)).width).replace('px','') + 'px';

document.getElementById('overlayedi').style.height=('' + document.getElementById('imgdet' + ('' + inm)).height).replace('px','') + 'px';

document.getElementById('overlayedi').onclick = function(){ var woo=window.open('','_blank','top=100,left=100,width=' + document.getElementById('overlayedi').style.width.replace('px','') + ',height=' + document.getElementById('overlayedi').style.height.replace('px','')); woo.document.write('<html><head><title>Overlayed Images Below ...</title></head><body>' + document.getElementById('overlayedi').outerHTML.replace(/left\:[\ ]*/g,'left:0.0').replace(/top\:[\ ]*/g,'top:0.0') + '</body></html>'); woo.document.title='Overlayed Images Below ...'; };

} else {

document.getElementById('overlayedi').innerHTML+='<img id=\"imgdet' + ('' + inm) + '\" src=\"' + document.getElementById('slideshow' + ('' + inm).replace(/^1$/g,'')).value + '\" ' + reposit + '></img>';

}

} else {

document.getElementById('detsum' + ('' + inm)).style.display='inline-block';

if (newop != ' ') {

if (newop.trim() == '') {

document.getElementById('imgdet' + inm).style.opacity='1.0';

} else {

document.getElementById('imgdet' + inm).style.opacity='' + newop;

}

}

if (newz != ' ') {

if (newz.trim() == '') {

document.getElementById('imgdet' + inm).style.zIndex='1';

} else {

document.getElementById('imgdet' + inm).style.zIndex='' + newzi;

}

}

}

return outdets;

}



function overlaythem() {

var suffidea=1;

while (document.getElementById('slideshow' + ('' + suffidea).replace(/^1$/g, '')).value != '') {

document.getElementById('ours' + ('' + suffidea)).innerHTML+=overlayds(suffidea,'','');

suffidea++;

}

}

You can try this at ourchanged tutorial_to_animated_gifโšซphp inhouse public domain Animated GIF Creator.


Previous relevant Animated GIF Creator Video Intranet Tutorial is shown below.

Animated GIF Creator Video Intranet Tutorial

Animated GIF Creator Video Intranet Tutorial   ๐Ÿ”

With the recent Animated GIF Creator Video Revisit Tutorial (preceding Animated GIF Creator Video Share Tutorial) we wrote โ€ฆ

โ€ฆ one reason being that we do not want to install the wonderful ffmpeg (command line video creation tool) on the RJM Programming domain, but, in macOS, here with MAMP, we are quite happy to live with the Homebrew (Terminal applicationโ€™s) install โ€ฆ

โ€ฆ setting up what could be โ€œlost functionalityโ€, but today, we come around to either adding a new โ€ฆ



Convert to Video

โ€ฆ dropdown option should all be ritchy ditch, and if not, often we will add new โ€œAdviceโ€ dropdown options to remind the user what theyโ€™d need to arrange to get to a โ€œConvert to Videoโ€ scenario.

Selecting โ€œConvert to Videoโ€ sets up a hydrid โ€œInternet/Intranetโ€ feeling scenario where โ€ฆ

Which begs the question โ€ฆ



How do we know when to offer the "Convert to Video" option on that dropdown?

This logic is centred around a few useful ideas (with this cross domain scenario ruling out Ajax and Iframe src= definitions, as useful ways to go) โ€ฆ

  1. open the MAMP local web server โ€œHTTP://localhost:8888/PHP/animegif/tutorial_to_animated_gif.phpโ€ URLs in an iframe (with onload event logics) pointed at by a window.open second argument (effectively avoiding any loose useful or not popup windows hanging around) โ€ฆ
  2. the most we can ask at the receiver is that window.opener is defined โ€ฆ and if so, just at that discovery โ€ฆ
  3. an image called โ€œamhere.jpgโ€ is created via PHP GD functionality โ€ฆ and back at the โ€œpublic domainโ€ parent within the iframe onload logic (where with contentWindow or contentDocument do not expect a document.body or even a document) โ€ฆ
  4. we attempt to โ€œhotlinkโ€ that MAMP local web server image โ€ฆ as per โ€ฆ


    var tryit='//localhost:8888/PHP/animegif/amhere.jpg';



    document.getElementById('ctvopt').value='advice';

    document.getElementById('ctvopt').innerHTML='Advice on Convert to Video';



    if (tryit != '') {

    var im=new Image();



    im.onload = function() {

    document.getElementById('ctvopt').value='video';

    console.log('this.height=' + eval('' + this.height));

    if (eval('' + this.height) >= 20) {

    document.getElementById('ctvopt').innerHTML='Convert to Video';

    } else {

    document.getElementById('ctvopt').innerHTML='Convert to Video (but ffmpeg not installed or in unexpected place)';

    }

    document.getElementById('imsel').title='All except Convert to Video, which needs ffmpeg installed, use ImageMagick';

    };




    im.src=tryit;

    tryit='';

    }


Previous relevant Animated GIF Creator Video Revisit Tutorial is shown below.

Animated GIF Creator Video Revisit Tutorial

Animated GIF Creator Video Revisit Tutorial   ๐Ÿ”

We hope you realize that ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator (helped out by achanged emailhtmlโšซphp inhouse email creator helper serverside PHP web application) can be accessed โ€ฆ

  1. in that public RJM Programming mode of use above โ€ฆ but even better can be โ€ฆ
  2. download relevant code to macOS MAMP local web server places off /Applications/MAMP/htdocs/ $_SERVER[โ€˜DOCUMENT_ROOTโ€™] places โ€ฆ

    โ€ฆ and check the code for the validity of any ImageMagick paths โ€ฆ and if not all these conditions, simulate the same and cobble it together in the code

โ€ฆ one reason being that we do not want to install the wonderful ffmpeg (command line video creation tool) on the RJM Programming domain, but, in macOS, here with MAMP, we are quite happy to live with the Homebrew (Terminal applicationโ€™s) install โ€ฆ



brew install ffmpeg

โ€ฆ to open a whole new woooooorrrrlllllddd of video creation opportunities using this MAMP local web URL โ€ฆ



HTTP://localhost:8888/PHP/animegif/tutorial_to_animated_gif.php# Animated GIF Creator on MAMP local web server

And so, onto yesterdayโ€™s Animated GIF Creator PDF Last Reveal Tutorial we decided to revisit video creation parts of our inhouse Animated GIF Creator on this MacBook Air. We needed to reinstall ffmpeg, and we show that in todayโ€™s animated GIF tutorial picture and also created the โ€œvideo.movโ€ video below, in the process โ€ฆ

โ€ฆ we tweaked out of โ€œvideo/mp4โ€ ffmpeg created videos thinking towards โ€œvideo/webmโ€ or โ€œvideo.movโ€ ffmpeg created videos that suit the โ€œfew frames but spaced out videoโ€ we wanted to achieve for all practical purposes, that โ€œvideo/mp4โ€ playing too fast for us to see anything much but the first and last slide โ€ฆ

<?php


$videofr=" -r " . (1000 / $delay) . " ";

$videofr=" -r " . (1000 / $delay) . " -filter:v setpts=" . ($delay / 1000) . "*PTS ";

$videomime="video/mp4";

$videoext=".mp4";



$videofr=" -framerate 0.1 ";

$videoext=".webm";

$videomime="video/webm";

$videomidbit="-c:v libvpx-vp9 -pix_fmt yuva420p -lossless 1 -c:a copy";

//$videocmd=$videopath . "ffmpeg -r " . (1000 / $delay) . " -filter:v setpts=" . ($delay / 1000) . "*PTS " . " -i " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "%03d.jpg " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.mp4 2> " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.bad";

//$svideocmd="ffmpeg -r " . (1000 / $delay) . " -filter:v setpts=" . ($delay / 1000) . "*PTS " . " -i " . "%03d.jpg " . "video.mp4";

$videocmd=$videopath . "ffmpeg " . $videofr . " -i " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "%03d.jpg " . $videomidbit . " " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video" . $videoext . " 2> " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.bad";

$svideocmd="ffmpeg " . $videofr . " -i " . "%03d.jpg " . $videomidbit . " " . "video" . $videoext;

$videocmd.="; " . $videopath . "ffmpeg -i " . " " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video" . $videoext . " " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.mov 2>> " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.bad";

$svideocmd.="; " . "ffmpeg -i " . " " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video" . $videoext . " " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.mov 2>> " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.bad";

$videohtml="<video title='" . $svideocmd . "' controls id=ivideo type='" . $videomime . "'><source src='video.mov'></source><source src='video" . $videoext . "'></source></video>";

$videosuffix="";


?>


Previous relevant Animated GIF Creator PDF Last Reveal Tutorial is shown below.

Animated GIF Creator PDF Last Reveal Tutorial

Animated GIF Creator PDF Last Reveal Tutorial   ๐Ÿ”

As a web application programmer we like buttons. There are โ€œbuttonsโ€ and there are buttons. Yes, there is an HTML button element, and it and the input type=button element render as that part of a webpage most recognizable to users the world over. You click or tap this button and something usually happens.

But we also enjoy โ€œEmoji Buttonsโ€ for we graphically challenged programmers. Using an emoji text and graphic can make span elements or p elements or lots of other HTML elements that have an innerHTML property, be like a very succinct button like entity, also appreciated around here because it takes up so little webpage โ€œreal estateโ€.

And so onto yesterdayโ€™s Animated GIF Creator PDF Order Tutorial we set about, today, โ€œrevealingโ€ any enduring animated GIF and/or PDF created during a previous session, using Emoji Buttons as the email/SMS sharing action buttons.

We say โ€œrevealingโ€ because, like the way โ€œEmoji Buttonsโ€ save webpage โ€œreal estateโ€, so can the use of the HTML5 details/summary element combination. It is in that summary โ€œenduringโ€ header part of that combination we can place some โ€œEmoji Buttonsโ€. You will (once you start creating and sharing animated GIFs and/or PDFs) see from ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator (helped out by achanged emailhtmlโšซphp inhouse email creator helper serverside PHP web application) that we place three Emoji Buttons โ€ฆ

  1. ๐Ÿ“Ÿ SMS (Animated GIF or PDF) Limited relevance period (ie. no data URIs involved, so rely on an absolute URL whose content might change or start not to exist down the track) โ€ฆ via โ€œaโ€ โ€œsms:โ€ link click/tap
  2. ๐Ÿ“ง Email (Animated GIF or PDF) Limited relevance period (ie. no data URIs involved, so rely on an absolute URL whose content might change or start not to exist down the track) โ€ฆ via โ€œaโ€ โ€œmailto:โ€ link click/tap
  3. ๐Ÿ“ง Email (Animated GIF or PDF) Enduring relevance (ie. data URIs involved, so do not rely on any absolute URL whose content might change or start not to exist down the track) โ€ฆ via PHP mail function means of sending email with HTML attachment containing the relevant Animated GIF or PDF

Yes, โ€œEmoji Buttonsโ€ can have their size controlled but not by the usual CSS width and height properties, but by the CSS font-size property. Here is the new Javascript function that those Emoji Button โ€œonclickโ€ logic points to โ€ฆ

<?php eho โ€


function askes(isemail, isoab) {

var esask='', izhr=null, izform=null;

var isoa=document.getElementById(isoab.id.replace('b',''));

if (isemail) {

esask=prompt('Please enter email address to send this to', '');

if (esask != null) {

if (esask.indexOf('@') != -1) {

if (isoa.outerHTML.indexOf('<img') == 0) {

//alert('More Animated GIF to come');

izhr = new XMLHttpRequest();

izform=new FormData();

izform.append('to', esask.trim());

izform.append('inline', '" . dirname(__FILE__) . DIRECTORY_SEPARATOR . server_remote_addr() . ".gif" . "');

izform.append('subj', 'My Latest Animated GIF via RJM Programming ... ');

izform.append('tdhuhta', ('<body><div title=\"" . explode('/animegif',$durlis)[0] . '/animegif/' . server_remote_addr() . "\" style=\"overflow:auto;-webkit-overflow-scrolling:touch;height:100%;\"><img style=\"width:100%;height:900px;\" src=\"" . dirname(__FILE__) . DIRECTORY_SEPARATOR . server_remote_addr() . ".gif" . "\"></img></div></body>'));

izhr.open('post', '//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php', true);

izhr.send(izform);

} else if (isoa.outerHTML.indexOf('<a') != 0) {

//alert('More PDF to come');

izhr = new XMLHttpRequest();

izform=new FormData();

izform.append('to', esask.trim());

izform.append('inline', '" . dirname(__FILE__) . DIRECTORY_SEPARATOR . server_remote_addr() . "_animegif.pdf" . "');

izform.append('subj', 'My Latest PDF via Animated GIF via RJM Programming ... ');

izform.append('tdhuhta', ('<body><div title=\"" . explode('/animegif',$durlis)[0] . '/animegif/' . server_remote_addr() . "_\" style=\"overflow:auto;-webkit-overflow-scrolling:touch;height:100%;\"><object style=\"width:100%;height:900px;\" type=\"application/pdf\" data=\"" . dirname(__FILE__) . DIRECTORY_SEPARATOR . server_remote_addr() . "_animegif.pdf" . "\"></object></div></body>'));

izhr.open('post', '//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php', true);

izhr.send(izform);

} else {

isoa.href='mailto:' + esask.trim() + '?' + isoa.href.split('?')[1];

isoa.click();

}

}

}

} else {

esask=prompt('Please enter SMS number to send this to', '');

if (esask != null) {

if ((esask.trim() != '' && esask.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '')) {

isoa.href='sms:' + esask.trim() + '&' + isoa.href.split('&')[1];

isoa.click();

}

}

}

}


โ€œ; ?>

Cute, huh?!


Previous relevant Animated GIF Creator PDF Order Tutorial is shown below.

Animated GIF Creator PDF Order Tutorial

Animated GIF Creator PDF Order Tutorial   ๐Ÿ”

Order becomes an interesting subject to us today regarding the PDF conversions possible in amongst the Animated GIF creating of yesterdayโ€™s Animated GIF Creator PDF Share Tutorial.

That is because we may have some advanced users out there that want that possibility of differentiating the data of โ€ฆ

  • animated GIF โ€ฆ containing all features asked for, in totality โ€ฆ from the chance for the user to have any of the PDF conversion option sets below โ€ฆ
  • PDF โ€ฆ one of โ€ฆ
    1. no PDF conversion
    2. full PDF conversion โ€ฆ with the user choices regarding raw image content and title and watermarking and ImageMagick and GD modifiers
    3. light PDF conversion โ€ฆ with the user choices regarding just raw image content (the only option out of these last three available before todayโ€™s work)
    4. medium PDF conversion โ€ฆ with the user choices regarding just ImageMagick and GD modifiers

โ€ฆ perhaps as a โ€œbefore and afterโ€ tool regarding presentations, maybe?

No dropdowns used here (enforcing an order), just the userโ€™s order in which they choose to select the โ€œPDF conversionโ€ option from the ImageMagick dropdown (in relation to other selections) determining how and when this PDF conversion occurs in the workflow through to creating the animated GIF with ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator serverside PHP web application. Just remember to select PDF Conversion as early as possible to do that โ€œlight PDF conversionโ€ option above and last thing if you are interested in โ€œfull PDF conversionโ€ (where you can create PDF documents with the bells and whistles ImageMagick and GD modifiers can offer) and todayโ€™s tutorial picture is an example of โ€œmedium PDF conversionโ€ (when we ordered our settings by first Grayscale, second PDF conversion and last title and watermarking options). Clicking or tapping the ImageMagick link can get the user to the Javascript popup window where they might define the email or SMS recipient for that PDF conversion data file download.


Previous relevant Animated GIF Creator PDF Share Tutorial is shown below.

Animated GIF Creator PDF Share Tutorial

Animated GIF Creator PDF Share Tutorial   ๐Ÿ”

To share yesterdayโ€™s Animated GIF Creator PDF Conversion Tutorial PDF data formatted image slides (and then onto an animated GIF) would be a step forward, wouldnโ€™t you say?

What sharing conduits do we code for? We always intended โ€ฆ

  • email โ€ฆ but as the day wore on trying to get the usage to work on mobile and non-mobile we decided to relinquish our wish to not have to create a user specific enduring (until that same browser type and user combination share) PDF document for the user request โ€ฆ mainly to get mobile email downloads to be friendly โ€ฆ and so this opened the door for โ€ฆ
  • SMS โ€ฆ to access that enduring PDF as a URL in the SMS message (that becomes a link for the recipient)

โ€ฆ the email methodology used being that โ€œmidair feelingโ€ Ajax/FormData approach in ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator serverside PHP web application โ€ฆ

<?php echo โ€


function emailhtmlit() {

var induri=ginduri;

var pemail='" . urldecode($_GET['outpdf']) . urldecode($_POST['outpdf']) . "';

if (pemail != null) {

if (pemail.indexOf('@') != -1 || (pemail.trim() != '' && pemail.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '')) {

if (induri.trim() == '') {

if (induri == '') {

document.getElementById('pdfproposed').src='./animegif.pdf?rand=' + Math.floor(Math.random() * 19854654);

} else {

ginduri='found';

}

setTimeout(emailhtmlit, 15000);

} else {

ginduri='';

var zhr = new XMLHttpRequest();

var zform=new FormData();

if (pemail.indexOf('@') != -1) { zform.append('to', pemail); }

zform.append('inline', '" . dirname(__FILE__) . DIRECTORY_SEPARATOR . "animegif.pdf" . "');

zform.append('subj', 'My PDF version of Animated GIF via RJM Programming ... ');

zform.append('tdhuhta', ('<body><div title=\"" . explode('/animegif',$durlis)[0] . '/animegif/' . server_remote_addr() . "_\" style=\"overflow:auto;-webkit-overflow-scrolling:touch;height:100%;\"><object style=\"width:100%;height:900px;\" type=\"application/pdf\" data=\"" . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'animegif.pdf' . "\"><embed style=\"width:100%;height:900px;\" type=\"application/pdf\" src=\"" . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'animegif.pdf' . "\"></embed></object></div></body>'));

//zform.append('tdhuhta', ('<body><iframe srcdoc=\"" . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'animegif.pdf' . "\"></iframe></body>'));

zhr.open('post', '//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php', true);

zhr.send(zform);

if (pemail.indexOf('@') == -1) {

var hrefp=document.getElementById('pdfsms').href.split('&body=')[0];

hrefp+=pemail.trim() + '&body=' + document.getElementById('pdfsms').href.split('&body=')[1];

document.getElementById('pdfsms').href=hrefp;

document.getElementById('pdfsms').click();

}

}

}

}

}


โ€œ; ?>

โ€ฆ and this called on our PHP email creator helper to better interface in its $_POST arguments reading section in ourchanged emailhtmlโšซphp inhouse email creator helper serverside PHP web application โ€ฆ

<?php


$psacv="";

$okayin=true;

$subd="";

$subptitle='';

$subdata="";

$subfile="";

$getpostfound=false;

<br>

foreach( $_POST as $name=>$val ) {

if ($val != "") {

// blah blah blah //file_put_contents("jnv." . $name, "jnv.inv00 " . strlen($phpcont));

if ($name == "tdhuhta" && $subfile != "" && $subdata != "" && strpos(str_replace("+"," ",urldecode($val)), $subfile) !== false) {

if (strpos(str_replace("+"," ",urldecode($val)), ' srcdoc="') !== false || strpos(str_replace("+"," ",urldecode($val)), ' data="') !== false) {

if (strpos(str_replace("+"," ",urldecode($val)), ' title="') !== false) { //file_put_contents('haaa.aaa',explode('/animegif/', explode('"', explode(' title="', str_replace("+"," ",urldecode($val)))[1])[0])[1]);

if (!file_exists('../PHP/animegif/' . explode('/animegif/', explode('"', explode(' title="', str_replace("+"," ",urldecode($val)))[1])[0])[1] . 'animegif.pdf')) {

if (file_exists('../PHP/animegif/animegif.pdf')) {

copy('../PHP/animegif/animegif.pdf', '../PHP/animegif/' . explode('/animegif/', explode('"', explode(' title="', str_replace("+"," ",urldecode($val)))[1])[0])[1] . 'animegif.pdf');

}

}

$psacv=explode('"', explode(' title="', str_replace("+"," ",urldecode($val)))[1])[0] . 'animegif.pdf';

$subptitle='<a target=_blank href="' . explode('"', explode(' title="', str_replace("+"," ",urldecode($val)))[1])[0] . 'animegif.pdf">Mobile whole PDF</a><br>';

}

$vrest=explode('"', explode(' srcdoc="',str_replace("+"," ",urldecode($val)))[1])[0];

$val=urlencode("<body>" . $subptitle . "<iframe style='width:100%;height:95vh;overflow:auto;-webkit-overflow-scrolling:touch;' srcdoc='<div style=width:92%;height:95vh;overflow:auto;-webkit-overflow-scrolling:touch;><object id=myobj style=width:95%;height:95vh; type=application/pdf data=\"" . $subdata . "\"></object></div>'></iframe></body>");

}

// blah blah blah

if ($name == "inline") {

if (strpos(str_replace("+"," ",urldecode($val)), 'animegif.pdf') !== false && isset($_POST['tdhuhta'])) {

if (file_exists(str_replace("+"," ",urldecode($val)))) {

$subfile=str_replace("+"," ",urldecode($val));

$subdata='data:application/pdf;base64,' . base64_encode(file_get_contents(str_replace("+"," ",urldecode($val))));

$val="";

$name="x";

$okayin=false;

}

}

// blah blah blah

}

}


?>

Creating the PDFs got helped out in โ€œreliability termsโ€ via the introduced animegifโšซphp inhouse Wait Around Longer serverside PHP web application.


Previous relevant Animated GIF Creator PDF Conversion Tutorial is shown below.

Animated GIF Creator PDF Conversion Tutorial

Animated GIF Creator PDF Conversion Tutorial   ๐Ÿ”

Up to yesterdayโ€™s Animated GIF Creator Slide Specific Application Tutorial the recent progress had us โ€ฆ

  • knowing the good places to intervene between the original slide image data being read in and the animated GIF slide output โ€ฆ and โ€ฆ
  • involvement of ImageMagick โ€ฆ so, today, these two help us down the path to โ€ฆ
  • adding PDF as an output format possibility, in addition to the animated GIF and other ideas floated as output formats

โ€ฆ with ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator serverside PHP web application.

We have more โ€œreliability workโ€ and โ€œemail sharing workโ€ to go after todayโ€™s start, but it primarily called on ImageMagick command lineโ€™s talent for a command like โ€ฆ



convert /tmp/imtmp0*.*[gGmMiI]* /tmp/imtmp000.pdf

โ€ฆ to โ€œconcatenateโ€ into the one output PDF file (called โ€œ/tmp/imtmp000.pdfโ€) the slides, arranged by our code into that โ€œ/tmp/imtmp0*.*[gGmMiI]*โ€ (file specification) arrangement above. Yes, we meant โ€œconvertโ€ above, as โ€œmogrifyโ€ (batch work) appears not to be able to perform this task.

We hope you stay the course!


Previous relevant Animated GIF Creator Slide Specific Application Tutorial is shown below.

Animated GIF Creator Slide Specific Application Tutorial

Animated GIF Creator Slide Specific Application Tutorial   ๐Ÿ”

Itโ€™s all fine and good improving on the ImageMagick and GD and Exif functionality modifications like with yesterdayโ€™s Animated GIF Creator Exif Rotation Compensation Tutorial, but in reality, if you are going to start creating animated GIFs to explain a process, you are going to want to apply these โ€œslide modifiersโ€ on a slide by slide basis, rather than enforcing a โ€œwhole of animated GIF slide setโ€ paradigm, as for the last few days worth of work.

And so, we decided to do what we often do, โ€œsliding inโ€ more functionality (chortle, chortle). We tend to want to โ€ฆ

  • start with hardcoded text (or element) โ€ฆ somewhere โ€ฆ today it happens to be in an HTML span element that once involved just โ€ฆ


    <span id="smyim"></span>


    โ€ฆ and used to get filled, Javascript DOM wise, when needed via โ€ฆ


    document.getElementById('smyim').innerHTML='ImageMagick switches: '; // and yes, it remains that way even now, but read on ...

  • add intelligence (quite often that being onclick logic(s)) to that hardcoded element via โ€ฆ


    <span id=smyim title=Application onclick=applyto(); style=cursor:pointer;text-decoration:underline;></span>

  • that serves the purpose, as the user clicks/taps it (alerted to that fact, perhaps, because we underline the element and add an appropriate cursor when hovering over it (plus a title)), of calling Javascript โ€ฆ


    function applyto() {

    var huhto=prompt('Apply ImageMagick and/or GD to which slides, in comma separated list, counting starting with 1? Defaults to applying to all slides. Comma delimit. Negatives mean all but. Ranges can be specified. For example ... 2,4-7,9', document.getElementById('appliedto').value);

    if (huhto == null) { huhto=''; }

    if (huhto.trim() == '') {

    document.getElementById('appliedto').value='';

    document.getElementById('smyim').title='Application';

    } else {

    document.getElementById('appliedto').value=huhto.trim();

    document.getElementById('smyim').title=huhto.trim();

    }

    }

  • to glean an (often times out of the normal workflow of the web application) informational piece of data, interactively, from the user, via a Javascript prompt popup

So thatโ€™s the clientside of this work โ€ฆ โ€œalerting the user to the existance of the functionalityโ€ you might say.

And then thereโ€™s โ€œthe applicationโ€ of that nuanced user requirement. And thatโ€™s where the โ€œinhouse โ€˜ourโ€™ prefix to wrapper function name paradigmsโ€ come in handy. We introduced โ€œblanketโ€ functionality thoughts via this approach, and so to โ€œpartially undoโ€ that thinking, we make the โ€œourโ€ prefix conditional, as is available to us with ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator serverside PHP web application (helped out by achanged exif_rotation_checkโšซphp inhouse Exif detector PHP helper), as per โ€ฆ

<?php


function ourcomplicated($inio, $iappl) {

$ideasl=explode(",", str_replace(' ','',$iappl));

$xour="our";

for ($iqa=0; $iqa<sizeof($ideasl); $iqa++) {

if (trim($ideasl[$iqa]) != '') {

$xour="";

if (('-' . $inio) == trim($ideasl[$iqa])) { return ""; }

$ideasr=explode("-", str_replace(' ','',trim($ideasl[$iqa])));

for ($iqb=0; $iqb<sizeof($ideasr); $iqb++) {

if (('' . $inio) == trim($ideasr[$iqb])) {

return "our";

}

if ($iqb == 1) {

if (trim($ideasr[1]) == "") { $ideasr[1]="99999999"; }

if ($inio >= $ideasr[0] && $inio <= $ideasr[1]) { return "our"; }

}

}

}

}

return $xour;

}



?>

โ€ฆ teamed with โ€ฆ

<?php


$ours="our";

for ($io=1; $io$ours=ourcomplicated($io, $iappliedto);

// blah blah blah

if (strpos($aphoto[0], ";base64,") !== false) {

$gifphp.=str_replace("imagecreatefromjpeg('source01.jpg');", "" . $ours . "imagecreatefromstring(base64_decode('" . explode(";base64,",$aphoto[0])[1] . "'));", str_replace("\$text='';", "\$text=\"" . str_replace("+"," ",urldecode($atext)) . "\";", $eachonestring));

} else if (strpos(strtolower($aphoto[0]), "//") !== false) {

$gifphp.=str_replace("imagecreatefromjpeg('source01.jpg');", "" . $ours . "imagecreatefromstring(@file_get_contents('" . $prefix . $aphoto[0] . "'));", str_replace("\$text='';", "\$text=\"" . str_replace("+"," ",urldecode($atext)) . "\";", $eachone));

} else if (strpos(strtolower($aphoto[0]), ".jp") !== false) {

if (strpos($prefix, "../../") !== false && !file_exists($prefix . $aphoto[0]) && file_exists(str_replace("../../","../",$prefix) . $aphoto[0])) {

$prefix=str_replace("../../","../",$prefix);

}

//file_put_contents('qpqp.qpqp', $eachone . "\n\n" . $atext . "\n\n" . str_replace("\$text='';", "\$text=\"" . str_replace("+"," ",urldecode($atext)) . "\";", $eachone));

$gifphp.=str_replace("imagecreatefromjpeg('source01.jpg');", "" . $ours . "imagecreatefromjpeg('" . $prefix . $aphoto[0] . "');", str_replace("\$text='';", "\$text=\"" . str_replace("+"," ",urldecode($atext)) . "\";", $eachone));

//file_put_contents('qpqpqp.qpqpqp', $gifphp);

} else if (strpos(strtolower($aphoto[0]), ".png") !== false) {

if (strpos($prefix, "../../") !== false && !file_exists($prefix . $aphoto[0]) && file_exists(str_replace("../../","../",$prefix) . $aphoto[0])) {

$prefix=str_replace("../../","../",$prefix);

}

$gifphp.=str_replace("imagecreatefromjpeg('source01.jpg');", "" . $ours . "imagecreatefrompng('" . $prefix . $aphoto[0] . "');", str_replace("\$text='';", "\$text=\"" . str_replace("+"," ",urldecode($atext)) . "\";", $eachone));

} else if (strpos(strtolower($aphoto[0]), ".gif") !== false) {

if (strpos($prefix, "../../") !== false && !file_exists($prefix . $aphoto[0]) && file_exists(str_replace("../../","../",$prefix) . $aphoto[0])) {

$prefix=str_replace("../../","../",$prefix);

}

$gifphp.=str_replace("imagecreatefromjpeg('source01.jpg');", "" . $ours . "imagecreatefromgif('" . $prefix . $aphoto[0] . "');", str_replace("\$text='';", "\$text=\"" . str_replace("+"," ",urldecode($atext)) . "\";", $eachone));

} else if (strpos(strtolower($aphoto[0]), ".bmp") !== false) {

if (strpos($prefix, "../../") !== false && !file_exists($prefix . $aphoto[0]) && file_exists(str_replace("../../","../",$prefix) . $aphoto[0])) {

$prefix=str_replace("../../","../",$prefix);

}

$gifphp.=str_replace("imagecreatefromjpeg('source01.jpg');", "" . $ours . "imagecreatefrombmp('" . $prefix . $aphoto[0] . "');", str_replace("\$text='';", "\$text=\"" . str_replace("+"," ",urldecode($atext)) . "\";", $eachone));

}

// blah blah blah

}


?>

We use these โ€œnew abilitiesโ€ better explaining โ€œthe abscence or otherwise of Exif checkingโ€, and the implications of that in the animated GIF creator woooooorrrrrrlllllddd, contrasting the first two slides, showing one with โ€œNo Exif checkingโ€ (the bad old days) versus โ€œWith Exif checkingโ€ (the renaissance of liberated thinking in the South South East woooorrrrrlllldddd) in todayโ€™s animated GIF presentation.

Get the picture?!


Previous relevant Animated GIF Creator Exif Rotation Compensation Tutorial is shown below.

Animated GIF Creator Exif Rotation Compensation Tutorial

Animated GIF Creator Exif Rotation Compensation Tutorial   ๐Ÿ”

The recent couple of days of work like yesterdayโ€™s Animated GIF Creator GD Transformations Interfacing Tutorial have given us โ€œrotation functionalityโ€ tools to counteract the unusual effects Exif โ€ฆ

Exchangeable image file format (officially Exif, according to JEIDA/JEITA/CIPA specifications) is a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras.

โ€ฆ can have converting mobile device camera created images into animated GIFs via ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator PHP web application.

But with some photos itโ€™s there in the photoโ€™s metadata information letting the future user know what orientation the camera of that mobile device was in as you took the photo. In order to help our animated GIF creator, the first slide image is scoured for Exif metadata and if found, a suitable rotation correction can be applied to the slides there and then. In order to scour for Exif metadata we needed to write a exif_rotation_checkโšซphp inhouse Exif detector PHP helper.


Previous relevant Animated GIF Creator GD Transformations Interfacing Tutorial is shown below.

Animated GIF Creator GD Transformations Interfacing Tutorial

Animated GIF Creator GD Transformations Interfacing Tutorial   ๐Ÿ”

The PHP GD image library is so much more useful than for the โ€œfiltersโ€ interfaced to with yesterdayโ€™s Animated GIF Creator GD Filter Interfacing Tutorial. Under an โ€œumbrella termโ€ transformations, today we add interfacing to GD functionality โ€ฆ

โ€ฆ into ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator PHP web application. We found it more user friendly to tailor the asking of numerical parameters for these GD calls work via โ€ฆ

<?php


$gfcds='';

$gdfs=[];

if (strpos(($imvgn . $imafn . $imqty . $imgds), '|') !== false) {

$gdfs=explode(';', trim(explode('|', $imvgn . $imafn . $imqty . $imgds)[1]));

for ($itf=0; $itf<sizeof($gdfs); $itf++) {

if (trim($gdfs[$itf]) != '') {

if (trim($gdfs[$itf]) == strtolower(trim($gdfs[$itf]))) {

$gfcds.=chr(10) . " imagefilter(" . "$" . "oimo, IMG_FILTER_" . strtoupper(trim($gdfs[$itf])) . "); " . chr(10);

} else if (trim($gdfs[$itf]) == strtoupper(trim($gdfs[$itf]))) {

$gfcds.=chr(10) . " image" . explode(',',explode(" ",strtolower(trim($gdfs[$itf])))[0])[0] . "(" . "$" . "oimo, IMG_" . str_replace(" ","_",strtoupper(trim( str_replace(explode(' ',$gdfs[$itf])[0] . ' ','',$gdfs[$itf]) ))) . "); " . chr(10);

} else if (strpos(strtoupper(trim($gdfs[$itf])), "SCALE") !== false) {

$gfcds.=chr(10) . " $" . "oimo=image" . explode(',',explode(" ",strtolower(trim($gdfs[$itf])))[0])[0] . "(" . "$" . "oimo" . str_replace(" ","_",(trim( str_replace(explode(',',explode(" ",(trim($gdfs[$itf])))[0])[0],'',$gdfs[$itf]) ))) . "); " . chr(10);

} else if (strpos(strtoupper(trim($gdfs[$itf])), "COPY") === false) {

$gfcds.=chr(10) . " image" . explode(',',explode(" ",strtolower(trim($gdfs[$itf])))[0])[0] . "(" . "$" . "oimo" . str_replace(" ","_",(trim( str_replace(explode(',',explode(" ",(trim($gdfs[$itf])))[0])[0],'',$gdfs[$itf]) ))) . "); " . chr(10);

} else {

$gfcds.=chr(10) . " image" . explode(',',explode(" ",strtolower(trim($gdfs[$itf])))[0])[0] . "(" . "$" . "oimo" . "," . "$" . "oimo" . explode("," . "$" . "oimo", $gdfs[$itf])[1] . "); " . chr(10);

}

}

}

}


?>

โ€ฆ to work with modified PHP writes PHP of the ilk โ€ฆ

<?php echo โ€


function ourimagecreatefromstring(\$inidis) {

global \$imvgn, \$imafn, \$imqty, \$imgds, \$gfcds;

if ((\$imvgn . \$imafn . \$imqty . \$imgds) != '' && strpos(\$inidis, ';base64,') !== false) {

\$extis=str_replace('jpeg','jpg',explode('/', explode(';base64,', \$inidis)[0])[1]);

\$inextis=\$extis;

\$sofarout='/tmp/imtmp.' . \$extis;

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

unlink(\$imfilename);

}

file_put_contents(\$sofarout, base64_encode(explode(';base64,', \$inidis)[1]));

\$fzis=filesize(\$sofarout);

if (trim(explode('|', \$imvgn . \$imafn . \$imqty . \$imgds)[0]) != '') {

exec('" . $immogpath . "mogrify ' . explode('|', \$imvgn . \$imafn . \$imqty . \$imgds)[0] . ' /tmp/imtmp.' . \$extis);

}

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

if (filesize(\$imfilename) != \$fzis) { // strpos(\$imfilename, '.' . \$extis) === false ||

\$sofarout=\$imfilename;

\$extis=explode('.', \$imfilename)[1];

}

}

\$oimo=null;

if (strtolower(\$extis) == 'png') {

\$oimo=imagecreatefrompng('/tmp/imtmp.' . \$extis); " . $gfcds . "

} else if (strtolower(\$extis) == 'bmp') {

\$oimo=imagecreatefrombmp('/tmp/imtmp.' . \$extis); " . $gfcds . "

} else if (strtolower(\$extis) == 'gif') {

\$oimo=imagecreatefromgif('/tmp/imtmp.' . \$extis); " . $gfcds . "

} else if (strpos(strtolower(\$extis), 'jp') !== false) {

\$oimo=imagecreatefromjpeg('/tmp/imtmp.' . \$extis); " . $gfcds . "

}

if (\$oimo) { return \$oimo; }

} else if ((\$imvgn . \$imafn . \$imqty . \$imgds) != '') {

\$extis=str_replace('jpeg','jpg','" . $inextis . "');

\$inextis=\$extis;

\$sofarout='/tmp/imtmp.' . \$extis;

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

unlink(\$imfilename);

}

file_put_contents(\$sofarout, \$inidis);

\$fzis=filesize(\$sofarout);

if (strpos(strtolower((\$imvgn . \$imafn . \$imqty . \$imgds)), '-format ') === false) { \$imvgn.=' -format " . str_replace('jpg','jpeg',$inextis) . " '; }

if (trim(explode('|', \$imvgn . \$imafn . \$imqty . \$imgds)[0]) != '') {

exec('" . $immogpath . "mogrify ' . explode('|', \$imvgn . \$imafn . \$imqty . \$imgds)[0] . ' /tmp/imtmp.' . \$extis);

}

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

if (filesize(\$imfilename) != \$fzis) { // strpos(\$imfilename, '.' . \$extis) === false) {

\$sofarout=\$imfilename;

\$extis=explode('.', \$imfilename)[1];

}

}

\$oimo=null;

if (strtolower(\$extis) == 'png') {

\$oimo=imagecreatefrompng('/tmp/imtmp.' . \$extis); " . $gfcds . "

} else if (strtolower(\$extis) == 'bmp') {

\$oimo=imagecreatefrombmp('/tmp/imtmp.' . \$extis); " . $gfcds . "

} else if (strtolower(\$extis) == 'gif') {

\$oimo=imagecreatefromgif('/tmp/imtmp.' . \$extis); " . $gfcds . "

} else if (strpos(strtolower(\$extis), 'jp') !== false) {

\$oimo=imagecreatefromjpeg('/tmp/imtmp.' . \$extis); " . $gfcds . "

}

if (\$oimo) { return \$oimo; }

}

return imagecreatefromstring(\$inidis);

}


โ€œ; โ€œ?>

โ€ฆ and to get there clientwise, in the Javascript โ€ฆ



function gdadd(oselo) {

var pari=1, thispari='0';

if (oselo.value != '') {

//alert(oselo.value);

var oselovalue=oselo.value.replace(',' + '$' + 'oimo','~' + '$' + 'oimo').split(',')[0];

//alert(oselovalue);

var oseloval=oselo.value;

if (document.getElementById('imgds')) { if (document.getElementById('imgds').value == '') { document.getElementById('imgds').value='|'; } else { document.getElementById('imgds').value+=';'; } }

oseloval=oseloval.replace(',' + '$' + 'oimo','~' + '$' + 'oimo');

oseloval=oseloval.replace(oseloval.split(',')[0], '');

while (oseloval.indexOf(',') != -1) {

//alert(oseloval);

if ((oseloval + ' ').substring(1).split(',')[0].trim() != '') {

if ((' ' + (oseloval + ' ').substring(1).split(',')[0].trim() + ' ').toLowerCase().indexOf(' colour ') != -1) {

thispari=prompt('Enter' + (' ' + (oseloval + ' ').substring(1).split(',')[0].trim() + ' ').toLowerCase().replace(' colour ', ' red,green,blue colour ') + 'parameter for GD ' + oselo.value.split(',')[0] + ' ' + pari + ' of ' + eval(-1 + oselo.value.replace(',' + '$' + 'oimo','').split(',').length) + '?', '0');

if (thispari == null) {

thispari='0';

} else if (thispari.trim() == '') {

thispari='0';

} else if (thispari.indexOf(',') == -1) {

oselovalue+=',' + thispari + '';

} else {

oselovalue+=',imagecolorallocate(' + '$' + 'oimo,' + thispari + ')';

}

} else {

thispari=prompt('Enter ' + (oseloval + ' ').substring(1).split(',')[0].trim() + ' parameter for GD ' + oselo.value.split(',')[0] + ' ' + pari + ' of ' + eval(-1 + oselo.value.replace(',' + '$' + 'oimo','').split(',').length) + '?', '0');

if (thispari == null) {

thispari='0';

} else {

oselovalue+=',' + thispari;

}

}

oseloval=oseloval.replace(',' + (oseloval + ' ').substring(1).split(',')[0].trim(),'').trim();

} else {

thispari=prompt('Enter numerical parameter for GD ' + oselo.value.split(',')[0] + ' ' + pari + ' of ' + eval(-1 + oselo.value.replace(',' + '$' + 'oimo','').split(',').length) + '?', '0');

oseloval=oseloval.replace(',','');

if (thispari == null) {

thispari='0';

} else {

oselovalue+=',' + thispari;

}

}

//oseloval=oseloval.replace(oseloval.split(',')[0] + ',', '');

//oseloval=oseloval.replace(',','');

pari++;

}

if (document.getElementById('gdopt')) {

document.getElementById('gdopt').innerHTML+='  ' + oselovalue.replace('~',',');

}

if (document.getElementById('imgds')) {

document.getElementById('imgds').value+=oselovalue.replace('~',',');

//document.getElementById('imgds').style.display='inline-block';

//document.getElementById('imgds').style.width='300px';

if (document.getElementById('smyim').innerHTML == '') { document.getElementById('smyim').innerHTML='ImageMagick switches: '; }

} else if (document.getElementById('myim')) {

document.getElementById('myim').innerHTML='<span is=smyim>ImageMagick switches: </span><input id=imqty name=imqty type=text style=display:inline-block; value=\"\"></input><input id=imgds name=imgds type=hidden style=display:inline-block; value=\"|' + oselovalue.replace('~',',') + '\"></input>';

document.getElementById('imqty').style.width='300px';

}

oselo.value='';

}

}


Previous relevant Animated GIF Creator GD Filter Interfacing Tutorial is shown below.

Animated GIF Creator GD Filter Interfacing Tutorial

Animated GIF Creator GD Filter Interfacing Tutorial   ๐Ÿ”

We are into image modification on the way to creating โ€œcompiledโ€ animated GIF images, at the moment. Yesterdayโ€™s Animated GIF Creator ImageMagick Interfacing Tutorial got us interfacing (or integrating) โ€ฆ

  • ImageMagick batch processing โ€œmogrifyโ€ ideas โ€ฆ and, today, it is the turn of โ€ฆ
  • GD image filters โ€ฆ

โ€ฆ into ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator PHP web application.


Previous relevant Animated GIF Creator ImageMagick Interfacing Tutorial is shown below.

Animated GIF Creator ImageMagick Interfacing Tutorial

Animated GIF Creator ImageMagick Interfacing Tutorial   ๐Ÿ”

Yes, you guessed it! On top of yesterdayโ€™s ImageMagick Vignette Primer Tutorial, today we want to interface the ImageMagick batch processing โ€œmogrifyโ€ ideas into ourchanged tutorial_to_animated_gifโšซphp inhouse Animated GIF Creator PHP web application.

โ€œInterfacingโ€ (or integrating) into code often has you asking the question โ€ฆ



Where do we intervene to place our logic?

Weโ€™ve decided to โ€œwrapโ€ our PHP GD calls โ€ฆ

โ€ฆ into inhouse โ€œourโ€ prefixed function versions as per (PHP writing out PHP) โ€ฆ

<?php echo โ€


\$imvgn='" . $imvgn . "'; /" . "/ vignette factor

\$imafn='" . $imafn . "'; /" . "/ affine transformation

\$imqty='" . $imqty . "'; /" . "/ image conversion and/or quality RE jpeg




function ourimagecreatefromstring(\$inidis) {

global \$imvgn, \$imafn, \$imqty;

if ((\$imvgn . \$imafn . \$imqty) != '' && strpos(\$inidis, ';base64,') !== false) {

\$extis=str_replace('jpeg','jpg',explode('/', explode(';base64,', \$inidis)[0])[1]);

\$inextis=\$extis;

\$sofarout='/tmp/imtmp.' . \$extis;

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

unlink(\$imfilename);

}

file_put_contents(\$sofarout, base64_encode(explode(';base64,', \$inidis)[1]));

\$fzis=filesize(\$sofarout);

exec('" . $immogpath . "mogrify ' . \$imvgn . \$imafn . \$imqty . ' /tmp/imtmp.' . \$extis);

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

if (filesize(\$imfilename) != \$fzis) { // strpos(\$imfilename, '.' . \$extis) === false ||

\$sofarout=\$imfilename;

\$extis=explode('.', \$imfilename)[1];

}

}

if (strtolower(\$extis) == 'png') {

return imagecreatefrompng('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'bmp') {

return imagecreatefrombmp('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'gif') {

return imagecreatefromgif('/tmp/imtmp.' . \$extis);

} else if (strpos(strtolower(\$extis), 'jp') !== false) {

return imagecreatefromjpeg('/tmp/imtmp.' . \$extis);

}

} else if ((\$imvgn . \$imafn . \$imqty) != '') {

\$extis=str_replace('jpeg','jpg','" . $inextis . "');

\$inextis=\$extis;

\$sofarout='/tmp/imtmp.' . \$extis;

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

unlink(\$imfilename);

}

file_put_contents(\$sofarout, \$inidis);

\$fzis=filesize(\$sofarout);

if (strpos(strtolower((\$imvgn . \$imafn . \$imqty)), '-format ') === false) { \$imvgn.=' -format " . str_replace('jpg','jpeg',$inextis) . " '; }

exec('" . $immogpath . "mogrify ' . \$imvgn . \$imafn . \$imqty . ' /tmp/imtmp.' . \$extis);

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

if (filesize(\$imfilename) != \$fzis) { // strpos(\$imfilename, '.' . \$extis) === false) {

\$sofarout=\$imfilename;

\$extis=explode('.', \$imfilename)[1];

}

}

if (strtolower(\$extis) == 'png') {

return imagecreatefrompng('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'bmp') {

return imagecreatefrombmp('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'gif') {

return imagecreatefromgif('/tmp/imtmp.' . \$extis);

} else if (strpos(strtolower(\$extis), 'jp') !== false) {

return imagecreatefromjpeg('/tmp/imtmp.' . \$extis);

}

}

return imagecreatefromstring(\$inidis);

}



function ourimagecreatefromjpeg(\$inidis) {

global \$imvgn, \$imafn, \$imqty;

if ((\$imvgn . \$imafn . \$imqty) != '') {

\$extis='jpg';

\$inextis=\$extis;

\$sofarout='/tmp/imtmp.' . \$extis;

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

unlink(\$imfilename);

}

file_put_contents(\$sofarout, \$inidis);

\$fzis=filesize(\$sofarout);

exec('" . $immogpath . "mogrify ' . \$imvgn . \$imafn . \$imqty . ' /tmp/imtmp.' . \$extis);

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

if (filesize(\$imfilename) != \$fzis) { // strpos(\$imfilename, '.' . \$extis) === false) {

\$sofarout=\$imfilename;

\$extis=explode('.', \$imfilename)[1];

}

}

if (strtolower(\$extis) == 'png') {

return imagecreatefrompng('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'bmp') {

return imagecreatefrombmp('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'gif') {

return imagecreatefromgif('/tmp/imtmp.' . \$extis);

} else if (strpos(strtolower(\$extis), 'jp') !== false) {

return imagecreatefromjpeg('/tmp/imtmp.' . \$extis);

}

}

return imagecreatefromjpeg(\$inidis);

}



function ourimagecreatefrompng(\$inidis) {

global \$imvgn, \$imafn, \$imqty;

if ((\$imvgn . \$imafn . \$imqty) != '') {

\$extis='png';

\$inextis=\$extis;

\$sofarout='/tmp/imtmp.' . \$extis;

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

unlink(\$imfilename);

}

file_put_contents(\$sofarout, \$inidis);

\$fzis=filesize(\$sofarout);

exec('" . $immogpath . "mogrify ' . \$imvgn . \$imafn . \$imqty . ' /tmp/imtmp.' . \$extis);

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

if (filesize(\$imfilename) != \$fzis) { // strpos(\$imfilename, '.' . \$extis) === false) {

\$sofarout=\$imfilename;

\$extis=explode('.', \$imfilename)[1];

}

}

if (strtolower(\$extis) == 'png') {

return imagecreatefrompng('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'bmp') {

return imagecreatefrombmp('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'gif') {

return imagecreatefromgif('/tmp/imtmp.' . \$extis);

} else if (strpos(strtolower(\$extis), 'jp') !== false) {

return imagecreatefromjpeg('/tmp/imtmp.' . \$extis);

}

}

return imagecreatefrompng(\$inidis);

}



function ourimagecreatefromgif(\$inidis) {

global \$imvgn, \$imafn, \$imqty;

if ((\$imvgn . \$imafn . \$imqty) != '') {

\$extis='gif';

\$inextis=\$extis;

\$sofarout='/tmp/imtmp.' . \$extis;

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

unlink(\$imfilename);

}

file_put_contents(\$sofarout, \$inidis);

\$fzis=filesize(\$sofarout);

exec('" . $immogpath . "mogrify ' . \$imvgn . \$imafn . \$imqty . ' /tmp/imtmp.' . \$extis);

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

if (filesize(\$imfilename) != \$fzis) { // strpos(\$imfilename, '.' . \$extis) === false) {

\$sofarout=\$imfilename;

\$extis=explode('.', \$imfilename)[1];

}

}

if (strtolower(\$extis) == 'png') {

return imagecreatefrompng('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'bmp') {

return imagecreatefrombmp('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'gif') {

return imagecreatefromgif('/tmp/imtmp.' . \$extis);

} else if (strpos(strtolower(\$extis), 'jp') !== false) {

return imagecreatefromjpeg('/tmp/imtmp.' . \$extis);

}

}

return imagecreatefromgif(\$inidis);

}



function ourimagecreatefrombmp(\$inidis) {

global \$imvgn, \$imafn, \$imqty;

if ((\$imvgn . \$imafn . \$imqty) != '') {

\$extis='bmp';

\$inextis=\$extis;

\$sofarout='/tmp/imtmp.' . \$extis;

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

unlink(\$imfilename);

}

file_put_contents(\$sofarout, \$inidis);

\$fzis=filesize(\$sofarout);

exec('" . $immogpath . "mogrify ' . \$imvgn . \$imafn . \$imqty . ' /tmp/imtmp.' . \$extis);

foreach (glob('/tmp/imtmp.*') as \$imfilename) {

if (filesize(\$imfilename) != \$fzis) { // strpos(\$imfilename, '.' . \$extis) === false) {

\$sofarout=\$imfilename;

\$extis=explode('.', \$imfilename)[1];

}

}

if (strtolower(\$extis) == 'png') {

return imagecreatefrompng('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'bmp') {

return imagecreatefrombmp('/tmp/imtmp.' . \$extis);

} else if (strtolower(\$extis) == 'gif') {

return imagecreatefromgif('/tmp/imtmp.' . \$extis);

} else if (strpos(strtolower(\$extis), 'jp') !== false) {

return imagecreatefromjpeg('/tmp/imtmp.' . \$extis);

}

}

return imagecreatefrombmp(\$inidis);

}


โ€œ; ?>

โ€ฆ and change existant calls into (equivalent inhouse) โ€œourโ€ function calls as above.


Previous relevant ImageMagick Vignette Primer Tutorial is shown below.

ImageMagick Vignette Primer Tutorial

ImageMagick Vignette Primer Tutorial   ๐Ÿ”

Continuing on with the ImageMagick batch processing โ€œmogrifyโ€ ideas of yesterdayโ€™s ImageMagick Batch Image Conversion Affine Transformation Tutorial and the โ€œvignetteโ€ image editing ideas of Gimp Vignette Primer Tutorial, as below, today, we took some pet photos with an iPadโ€™s Camera app and shared them off the Photos app via two Mail sharing option emails containing seven attachments each. Using an iPad, the JPEG โ€œjpgโ€ output files were too big for our inhouse Animated GIF Creator PHP web application to handle, and so to perform the โ€ฆ

  • animated GIF presentation, off these downloaded email photo attachments โ€ฆ and along the way โ€ฆ
  • quality adjusted them (yes, โ€œmogrifyโ€ does not stuff JPG to JPG conversions, and we used โ€œmogrifyโ€ -quality 20% switch here) โ€ฆ and โ€ฆ
  • rotate them 180 degrees (โ€œmogrifyโ€ uses switches -affine -1,0,0,-1,0,0 -transform +repage here) โ€ฆ and โ€ฆ
  • vignette 50% (โ€œmogrifyโ€ uses switch -vignette 50 here)

โ€ฆ on the way to compiling into an animated GIF image, and we turned to ImageMagick again, using its affine transformation talents, along with its awesome vignetting talents โ€ฆ




mogrify -quality 20% petvignettes12/*.jpg -comment "Straight off iPad 3x smaller to 1100x820 pet_photos_jpg_to_quality_20_jpg_1100_820.gif"

โ€ฆ where the last two dropdown options will be similar, the last showing the input image into ImageMagick can be an animated GIF that is truely treated like an animated GIF.

By the way, should you be interested in photo orientation off a mobile device camera, have a read of PHP Exif Image Information Revisit Tutorial.

Nala and Luna and Charlie bid you a fond farewell!


Previous relevant Gimp Vignette Primer Tutorial is shown below.

Gimp Vignette Primer Tutorial

Gimp Vignette Primer Tutorial   ๐Ÿ”

The last time we talked about the miraculous, redolent and amazing image editor called Gimp am sure there was someone in a shower โ€ฆ it stands to reason โ€ฆ and one of those showerers, surely, would have been singing The Gimp Song โ€ฆ and if not โ€ฆ why not? โ€ฆ but we digress โ€ฆ anyway we had the Gimp Transparency Primer Tutorial as shown below go into some image transparency issues with Gimp.

In todayโ€™s tutorial we make use of a great tutorial (even so far as with direct quotes below) called Add a Vignette to a Photograph with GIMP (thanks) to try a photographic technique called vignetting on one of the photographs we added, recently, into the mix of those of the Custom Header Image mix at this blog โ€ฆ specifically the one of Nala, the dog, on the door ledge. Need to warn you here and now that if there was the time all over again, it would be better achieved that second time around, but this is not the point with learning, but rather getting some starting point with a great โ€œproductโ€ like Gimp, and trying it yourself, once you have a method. It boils down to:

  1. Open Gimp graphical editor application
  2. File->Open โ€ฆ pick your image file
  3. Layer->New Layer (weโ€™ll call โ€œVgโ€) โ€ฆ pick Foreground Colour
  4. In the Layers dialog, click on your โ€œVgโ€ layer to select it, and select Soft light from the โ€œModeโ€ drop-down box
  5. Right click on your โ€œVgโ€ layer and go to Add Layer Mask. In the dialog that pops up, you want โ€œInitialise Layer Mask toโ€ set to โ€œWhite (full opacity)โ€. Click โ€œAddโ€
  6. Below Opacity bar select Link icon next to Eye icon, which will already be showing
  7. Use the freeform select tool (press F to bring this up) and draw a selection somewhere around the primary point of interest in your photo
  8. Use your bucket tool (Shift+B) and click within the selection to fill it
  9. Deselect your selection with Select->None
  10. Go to Filters->Blur->Gaussian Blur. In the dialog that comes up, you want โ€œRadiusโ€ set to a very large amount; a tenth of the longest edge of the photo is not too much
  11. Click on your โ€œVgโ€ layer to select it (if it isnโ€™t already selected), and then slide the opacity slider towards the right until the effect is subtle enough. Our (ever so subtle) example of Nala, in the tutorial, used an opacity of about 66%
  12. Click Export button in two windows (NB. this overwrites the image file, so if this is not desirable, export to a different image file name and/or type)

Here is an image comparison link.

As with most Gimp ideas, jump in and give it a go, as youโ€™ll find your own ways and means of using this great product โ€ฆ am pretty sure.

Link to Gimp โ€œspiritual homeโ€ โ€ฆ here.
Link to Gimp forum โ€ฆ here.


Previous relevant Gimp Transparency Primer Tutorial is shown below.

Gimp Transparency Primer Tutorial

Gimp Transparency Primer Tutorial   ๐Ÿ”

Here is a tutorial that adds to a previous Gimp Layers Primer Tutorial as shown below, and gives you more insight into the massive possibilities of using a sophisticated image editor and use layers with various amounts of transparency, especially suited to use with png image files.

Todayโ€™s tutorial where we construct a Birthday Card that needs tweaking for the words in front to be seen a bit more clearly, by making the image behind a bit more transparent, changes the transparency of a single image via:

  1. Open Gimp graphical editor application
  2. File->Open Layers โ€ฆ pick your image file
  3. If Layers window not showing, make it show via Windows->Layers โ€“ Brushes
  4. Below Opacity bar select Link icon next to Eye icon, which will already be showing
  5. Change Opacity bar setting to a value of Transparency (100% is Opaque, 0% is Transparent) that suits โ€ฆ today we do 70%
  6. File->Export
  7. Click Export button in two windows (NB. this overwrites the image file, so if this is not desirable, export to a different image file name and/or type)

As with most Gimp ideas, jump in and give it a go, as youโ€™ll find your own ways and means of using this great product โ€ฆ am pretty sure.

Link to Gimp โ€œspiritual homeโ€ โ€ฆ here.
Link to Gimp forum โ€ฆ here.


Previous relevant Gimp Layers Primer Tutorial is shown below.

Gimp Layers Primer Tutorial

Gimp Layers Primer Tutorial   ๐Ÿ”

Here is a tutorial that gives you an insight into the massive possibilities of using a sophisticated image editor and use layers with various amounts of transparency, especially suited to use with png image files.

Transparency (or its obverse, opacity) can be used to have the one image achieve several โ€œendsโ€ (ie. purposes). Although it is a bit of a clumsy example in the tutorial, you can see that the technique can be used for artistic purposes โ€ฆ often called โ€œPhotoshoppingโ€ (named after the more famous, and also brilliant, rival product, Photoshop).

Lots of those classic โ€œPhotoshoppingโ€ techniques can be achieved in Gimp, and some other tutorials at this blog touch on that.

Am sure you can imagine what the concept of a layer is with regard to image manipulation. Within Gimp, for beginners not used to this concept, you find yourself underestimating and underplaying what can be achieved with the various layers of a multi-layered image. In simplistic terms each layer has the functionality in Gimp to be treated as a whole new image, and this is the best way to think of it when trying to achieve what you want to achieve with Gimp.

Link to Gimp โ€œspiritual homeโ€ โ€ฆ here.
Link to Gimp forum โ€ฆ here.

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.


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.

This entry was posted in eLearning, Event-Driven Programming, Tutorials and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *