Two recent themes, and another we like, and enjoy using, combine today, as per …
- the “Landing Page” theme of yesterday’s Blog Posting Filtering Background Date Interfacing Tutorial … along with …
- not that we’ve said it in so many words, but, “the hotkey” work behind the scenes with the web application in the recent Keyboard Based Cursor Image Blog Source Link Tutorial‘s thread of blog postings … and today’s …
- “autocompletion” textbox (and associated dropdown) usage
… (along with good ol’ Javvascript DOM) to improve the functionality of the RJM Programming Landing Page means by which it connects to the RJM Programming WordPress Blog tutorial content.
Autocompletion is good primarily because it is quite a human response to fill in something given a “smaller” start, even given a modern baby’s likely first word …
goo … goog … googl … google
And so, if you have data at your disposal you would not have to wait for the baby to spout “google”. You might gather all the “google” relevant tutorials (and maybe some others) at the “goo” stage (or even earlier).
In our Landing Pages we do have this data available courtesy of the dropdown over to the right and down aways, populated by crontab PHP tasks undertaken each day up at the RJM Programming Apache/PHP/MySql web server. We’ve decided to copy that dropdown’s innerHTML content into the Javascript variable selcontis in the changed external Javascript WelcomeIndex.js “all Landing Pages helper” code below, where we add some new functions as well …
var selcontis='';
var acstr='';
var acsofar='';
function zotzmaybe(evt) {
var bigsih=document.getElementById('tuts').innerHTML.split('</option>')[0] + '</option>';
var bigs=[], jbigs=0, itot=0;
var testc='';
acstr=evt.target.value;
if (evt.keyCode >= 48 && evt.keyCode <= 57) {
acsofar=acstr + ('' + eval(-48 + evt.keyCode));
} else if (evt.keyCode >= 65 && evt.keyCode <= 90) {
acsofar=acstr + String.fromCharCode(evt.keyCode); //('' + eval(-65 + evt.keyCode));
} else if (evt.keyCode >= 97 && evt.keyCode <= 122) {
acsofar=acstr + + String.fromCharCode(evt.keyCode); //('' + eval(-97 + evt.keyCode));
} else {
acsofar+=' ';
}
//alert('acstr=' + acstr + ' and acsofar=' + acsofar);
if (selcontis.toLowerCase().indexOf('>' + acsofar.toLowerCase()) != -1) {
bigs=selcontis.split(new RegExp(('\>' + acsofar.toLowerCase()), 'i'));
for (jbigs=1; jbigs<bigs.length; jbigs++) {
testc='<option ' + bigs[eval(-1 + jbigs)].split('<option ')[eval(-1 + bigs[eval(-1 + jbigs)].split('<option ').length)] + selcontis.split('<option ' + bigs[eval(-1 + jbigs)].split('<option ')[eval(-1 + bigs[eval(-1 + jbigs)].split('<option ').length)])[1].substring(0, ('>' + acsofar).length) + bigs[eval(0 + jbigs)].split('</option>')[0] + '</option>';
if (testc.indexOf(')') != -1) {
itot++;
bigsih+=testc;
}
}
document.getElementById('tuts').innerHTML=bigsih;
document.getElementById('oneopti').innerHTML='Found ' + itot + ' for ' + acsofar + ' below ...';
} else {
document.getElementById('tuts').innerHTML=bigsih;
document.getElementById('oneopti').innerHTML='None found for ' + acsofar + ' ...';
}
}
function muchlater() {
document.getElementById('tuts').size='1';
}
function preChangeTutNow() {
if (!document.getElementById('autokey')) {
ChangeTutNow(document.getElementById('tuts'));
} else if (document.getElementById('tuts').outerHTML.indexOf(' data-onblur=') != -1 && document.getElementById('tuts').outerHTML.indexOf(' size=') != -1) {
ChangeTutNow(document.getElementById('tuts'));
}
document.body.style.cursor='pointer';
}
function autokeyway() {
var tutselrect=document.getElementById('tuts').getBoundingClientRect();
if (!document.getElementById('autokey') && document.getElementById('id3')) {
selcontis=document.getElementById('tuts').innerHTML;
var wasd=document.getElementById('id3').innerHTML.length;
document.getElementById('tuts').style.display='none';
document.getElementById('id3').innerHTML=document.getElementById('id3').innerHTML.replace(document.getElementById('tuts').outerHTML,'<input autocomplete="off" type=text id=autokey onkeydown="zotzmaybe(event);" style="display:inline-block;z-index:99;width:' + Math.floor(eval(0.5 * eval('' + tutselrect.width))) + 'px;" placeholder="Type tutorial finding word(s)" value="" autofocus=""></input>' + document.getElementById('tuts').outerHTML.split('>')[0].replace('none','inline-block').replace('90%', Math.floor(eval(0.48 * eval('' + tutselrect.width))) + 'px').replace(/\"\ on/g, '" data-on') + '><option id=oneopti value=" ">Your finding options below ...</option></select>');
setTimeout(muchlater, 10000);
//alert('' + tutselrect.width + ' was=' + wasd + ' vs ' + document.getElementById('id3').innerHTML.length);
} else if (!document.getElementById('autokey') && document.getElementById('i268')) {
selcontis=document.getElementById('tuts').innerHTML;
document.getElementById('i268').innerHTML+='<input autocomplete="off" type=text id=autokey onkeyup="otzmaybe(this);" onchange="otzmaybe(this); " onblur=" justcheck(this.value); " style="z-index:99;position:absolute;top:' + tutselrect.top + 'px;left:' + tutselrect.left + 'px;width:' + tutselrect.width + 'px;" placeholder="Type tutorial finding word(s)" value="" autofocus=""></input>';
//alert('' + tutselrect.top);
}
}
… the “red rag to a bull” clue that hotkeys are involved being the use of the “onkeydown” (and/or sometimes you see “onkeypress”) keyboard event pointing at function zotzmaybe. In “function zotzmaybe” too, autocompletion compares a hotkey result to data ahead of the display of the keystroke, by which time the incarnation of the original dropdown can be populated with appropriate entries, along with the original calls and ways of functioning. You need to see how a Landing Page caller of the WelcomeIndex.js external Javascript changed to allow for this, as per …
- Tell the cache we’ve changed WelcomeIndex.js …
<script async="async" type="text/javascript" src="Welcome_files/WelcomeIndex.js?Lawson=Now&rand=76987"></script>
- Substantially rearrange the tutorial dropdown’s attributes and first option element …
<select onchange=" if (('' + this.title).indexOf('.') != -1 && this.value.length <= 2) { autokeyway(); } else { if (1 == 1) { document.body.style.cursor='progress'; setTimeout(preChangeTutNow, 7000); } else { ChangeTutNow(this); } }" class='mytuts' id='tuts' style='margin-top:4px;width: 90%; background-color:pink;' title='Tutorials' onblur="if (document.getElementById('selfirstopt').innerHTML.indexOf('autocompletion keyboard') != -1) { document.getElementById('selfirstopt').innerHTML=document.getElementById('selfirstopt').innerHTML.replace('autocompletion keyboard','keyboard autocompletion'); if (this.value.length == 1) { this.value=' '; } } else if (('' + this.title).indexOf('.') != -1 && this.value.length == 1) { autokeyway(); }" onmouseout="this.title=this.title.split('.')[0] + '.';" ontouchdown="if (document.getElementById('selfirstopt').innerHTML.indexOf('autocompletion keyboard') != -1) { document.getElementById('selfirstopt').innerHTML=document.getElementById('selfirstopt').innerHTML.replace('autocompletion keyboard','keyboard autocompletion'); if (this.value.length == 1) { this.value=' '; } } else if (('' + this.title).indexOf('.') != -1 && this.value.length == 1) { autokeyway(); }" onmousedown="if (document.getElementById('selfirstopt').innerHTML.indexOf('autocompletion keyboard') != -1) { document.getElementById('selfirstopt').innerHTML=document.getElementById('selfirstopt').innerHTML.replace('autocompletion keyboard','keyboard autocompletion'); if (this.value.length == 1) { this.value=' '; } } else if (('' + this.title).indexOf('.') != -1 && this.value.length == 1) { autokeyway(); }" onclick="if (document.getElementById('selfirstopt').innerHTML.indexOf('autocompletion keyboard') != -1) { document.getElementById('selfirstopt').innerHTML=document.getElementById('selfirstopt').innerHTML.replace('autocompletion keyboard','keyboard autocompletion'); if (this.value.length == 1) { this.value=' '; } } else if (('' + this.title).indexOf('.') != -1 && this.value.length == 1) { autokeyway(); }"><option id=selfirstopt title="First option" selected='selected' value=' '>Tutorials (show blog, toggle sort order, click for autocompletion keyboard) ...</option>
- And a small tweak to the next option regarding toggling …
<option value=' '>Tutorials (toggle sort order and reselect and click first for autocompletion keyboard) ...</option>
… to add in a textbox and dropdown way for a user to use an autocompletion approach to finding topics of interest to filter the RJM Programming WordPress Blog tutorials via, in order to hone in on information and content of interest.
Stop Press
Until we line up our crontab PHP work (which effectively wipes out the tweaks above … sorry, viewers, earlier this morning) … we have the WelcomeIndex.js fix up as per …
function jsonloadf() {
var firsto=false, secondo=false;
var optsare=document.getElementsByTagName('option');
for (var ioptsare=0; ioptsare<optsare.length; ioptsare++) {
if (optsare[ioptsare].innerHTML.indexOf('toggle sort order') != -1) {
if (!firsto) {
if (optsare[ioptsare].innerHTML.indexOf('click for ') == -1 && optsare[ioptsare].innerHTML.indexOf(')') != -1) {
optsare[ioptsare].innerHTML=optsare[ioptsare].innerHTML.replace(')', ', click for autocompletion keyboard)');
optsare[ioptsare].id='selfirstopt';
}
firsto=true;
} else if (!secondo) {
if (optsare[ioptsare].innerHTML.indexOf('click first ') == -1 && optsare[ioptsare].innerHTML.indexOf(')') != -1) {
optsare[ioptsare].innerHTML=optsare[ioptsare].innerHTML.replace(')', ' and reselect and click first for autocompletion keyboard)');
}
secondo=true;
}
}
}
}
setTimeout(jsonloadf, 3000);
Previous relevant Blog Posting Filtering Background Date Interfacing Tutorial is shown below.
We wanted to nuance the Blog Content filtering functionality of Blog Posting Filtering Background Interfacing Tutorial by …
- adding to the existant word within blog posting title filtering prowess … with …
- date (YYYYMMDD) based date filtering of blog posting
… and needed to purloin (good ol’) WordPress codex 404.php PHP code functionality changes below …
29d28
< $mbd="";
32,148d30
< //file_put_contents('zac.zac', $_SERVER['QUERY_STRING']);
< if (isset($_GET['mustbedated'])) {
< $mbd=str_replace('+',' ',urldecode($_GET['mustbedated']));
< $mzs=explode(" ", $mbd);
< if (sizeof($mzs) > 1) {
< $newid="";
< $suffn="";
< if (strpos($mbd, ")") !== false) { $suffn=")"; }
< for ($imzs=0; $imzs<sizeof($mzs); $imzs++) {
< if (substr($mzs[$imzs],0,1) == '(') {
< $newid='(' . $newid;
< $mzs[$imzs]=substr($mzs[$imzs],1);
< }
< if ($mzs[$imzs] != '') {
< if (1 == 1 || (substr($mzs[$imzs],0,1) >= '0' && substr($mzs[$imzs],0,1) <= '9')) {
< if (substr($mzs[$imzs],0,1) >= '0' && substr($mzs[$imzs],0,1) <= '9' && strlen(str_replace(')','',$mzs[$imzs])) == 4) {
< $newid.=str_replace(')','',$mzs[$imzs]);
< } else if (substr($mzs[$imzs],0,1) >= '0' && substr($mzs[$imzs],0,1) <= '9' && strlen(str_replace(')','',$mzs[$imzs])) == 8) {
< $newid.=str_replace(')','',$mzs[$imzs]);
< } else if (substr($mzs[$imzs],0,1) >= '0' && substr($mzs[$imzs],0,1) <= '9' && strlen(str_replace(')','',$mzs[$imzs])) == 2 && strlen($newid) >= 4) {
< $newid.=str_replace(')','',$mzs[$imzs]);
< } else if (substr($mzs[$imzs],0,1) >= '0' && substr($mzs[$imzs],0,1) <= '9' && strlen(str_replace(')','',$mzs[$imzs])) == 2) {
< $suffn=str_replace(')','',$mzs[$imzs]) . $suffn;
< } else if (substr($mzs[$imzs],0,1) >= '0' && substr($mzs[$imzs],0,1) <= '9' && strlen(str_replace(')','',$mzs[$imzs])) == 1 && strlen($newid) >= 4) {
< $newid.='0' . str_replace(')','',$mzs[$imzs]);
< } else if (substr($mzs[$imzs],0,1) >= '0' && substr($mzs[$imzs],0,1) <= '9' && strlen(str_replace(')','',$mzs[$imzs])) == 1) {
< $suffn='0' . str_replace(')','',$mzs[$imzs]) . $suffn;
<
< } else if (strpos(strtolower($mzs[$imzs]), 'jan') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='01';
< } else {
< $suffn='01' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'feb') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='02';
< } else {
< $suffn='02' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'mar') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='03';
< } else {
< $suffn='03' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'apr') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='04';
< } else {
< $suffn='04' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'may') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='05';
< } else {
< $suffn='05' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'jun') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='06';
< } else {
< $suffn='06' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'jul') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='07';
< } else {
< $suffn='07' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'aug') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='08';
< } else {
< $suffn='08' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'sep') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='09';
< } else {
< $suffn='09' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'oct') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='10';
< } else {
< $suffn='10' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'nov') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='11';
< } else {
< $suffn='11' . $suffn;
< }
< } else if (strpos(strtolower($mzs[$imzs]), 'dec') !== false) {
< if (strlen($newid) >= 4) {
< $newid.='12';
< } else {
< $suffn='12' . $suffn;
< }
< }
<
< }
< }
< }
< $newid.=$suffn;
< if ($newid != "") { if (strlen($newid) == 8) { $mbd='(' . $newid . ')'; } else { $mbd=$newid; } }
< }
< if (strlen($mbd) == 8) { $mbd='(' . $mbd . ')'; }
< //file_put_contents('zab.zab', $mbd . ' ... ' . $mc);
< if (strpos($icontis, $mbd) !== false && sizeof($ideaarray) > 1) {
< $mc=$mbd;
< $iicontis=substr(explode($mc, $icontis)[0],-500,500) . $mc . explode($mc, $icontis)[1];
< $ideaarray=explode('&pp=&pn=&title=', $iicontis);
< //file_put_contents('zaa.zaa', $ideaarray[1]);
< }
< }
153,155c35,36
< if (isset($_GET['mustcontain']) || $mc != "") {
< if (strlen(trim($_GET['mustcontain'])) > 0 || $mc != "") {
< if ($mc == "") {
---
> if (isset($_GET['mustcontain'])) {
> if (strlen(trim($_GET['mustcontain'])) > 0) {
157,158d37
< }
< //file_put_contents('zaq.zaq', $mc);
161c40
< if (@preg_match($mc, null) === false || $mbd != "") { // not regexp
---
> if (@preg_match($mc, null) === false) { // not regexp
170,171d48
< } else {
< $mcs=explode(",", $mc);
175,178d51
< if ($mbd != "") {
< $numf=explode($mc, $icontis);
< //file_put_contents('zas.zas', '' . sizeof($numf));
< } else {
180d52
< }
184d55
< //file_put_contents('zat.zat', '' . sizeof($numf));
186d56
< //file_put_contents('zad.zad', '' . sizeof($numf) . ' ... ' . $ideaarray[2]);
190,199c60
< $nmc=sizeof($ideaarray);
< $oned=">";
< $twod="'";
< $threed='"';
< $allok=true;
< if ($mbd != "") { $nmc=(1 + sizeof($numf)); $oned="</option>"; $twod="</option>"; $threed="</option>"; $jmc=1; }
<
< //if ($mbd != "") { file_put_contents('zar.zar', '' . sizeof($mcs) . ' ' . sizeof($mcss) . ' ' . $nmc . ' ' . $mbd); }
<
< for ($imc=$jmc; $imc<$nmc; $imc++) {
---
> for ($imc=$jmc; $imc<sizeof($ideaarray); $imc++) {
203d63
< //file_put_contents('zag.zag', '' . sizeof($mcs) . ' ' . sizeof($mcss) . ' ' . $imc . ' ' . $mc);
206c66
< if (strpos(str_replace('_',' ',explode($threed,explode($twod,explode($oned, $ideaarray[$imc])[0])[0])[0]), $mcs[$sdf]) === false) {
---
> if (strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcs[$sdf]) === false) {
213c73
< if (strpos(str_replace('_',' ',explode($threed,explode($twod,explode($oned, $ideaarray[$imc])[0])[0])[0]), $mcss[$sdf]) === false) {
---
> if (strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcss[$sdf]) === false) {
220c80
< if (strpos(str_replace('_',' ',explode($threed,explode($twod,explode($oned, $ideaarray[$imc])[0])[0])[0]), $mcss[$sdf]) > strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcss[-1 + $sdf])) {
---
> if (strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcss[$sdf]) > strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcss[-1 + $sdf])) {
232,236c92
< //if (trim($ideaarray[$imc]) != '' && strpos($ideaarray[$imc],'(') !== false) {
< //file_put_contents('zah.zah', '' . $mc . ' ' . $ideaarray[$imc]);
< //}
< if (strpos(strtolower($ideaarray[$imc]), strtolower($mc)) !== false && $allok && ($mbd == "" || strpos(strtolower($ideaarray[$imc]), "tutorial (") !== false)) {
< //if ($mbd != "") { file_put_contents('zaf.zaf', '' . $mc); }
---
> if (strpos(strtolower($ideaarray[$imc]), strtolower($mc)) !== false && $allok) {
243c99
< if (($hd % 2) == 0 || $mbd != "") {
---
> if (($hd % 2) == 0) {
265c121
< if (($hd % 2) == 0 || $mbd != "") {
---
> if (($hd % 2) == 0) {
275c131
< if (sizeof($fhuhs) == 20 || (sizeof($fhuhs) == 1 && strlen($mbd) > 6)) { break; }
---
> if (sizeof($fhuhs) == 20) { break; }
281,282c137
< if (sizeof($fhuhs) == 1 && ($mbd != "" || $imc > (sizeof($ideaarray) / 2))) {
< //if ($mbd != "") { $huhrand=$forcedhuh; file_put_contents('zae.zae', '' . $mbd . ' ' . $fhuhs[0] . ' ' . $ideaarray[$fhuhs[0]]); }
---
> if (sizeof($fhuhs) == 1 && $imc > (sizeof($ideaarray) / 2)) {
293d147
< if ($mbd == "") {
306d159
< }
308,323d160
< if ($mbd != "") {
< $huhrand=$fhuhs[0];
< //file_put_contents('zan.zan', '' . $huhrand . ' ' . $ideaarray[$huhrand]);
< if (strpos(strtolower($ideaarray[$huhrand]), "tutorial (") !== false) {
< //$ptis=str_replace('_',' ',$ideaarray[$huhrand] . ")");
< $ptis=str_replace('_',' ',explode('Tutorial', explode('>', explode('"', $ideaarray[$huhrand])[0])[0])[0] . "Tutorial");
< //file_put_contents('zao.zao', '' . $ptis);
< } else if (strpos(strtolower($ideaarray[1 + $huhrand]), "tutorial (") !== false) {
< $huhrand++;
< //file_put_contents('zau.zau', ' ' . $huhrand . ' ' . $ideaarray[$huhrand]);
< //$ptis=str_replace('_',' ',$ideaarray[$huhrand] . ")");
< $ptis=str_replace('_',' ',explode('Tutorial', explode('>', explode('"', $ideaarray[$huhrand])[0])[0])[0] . "Tutorial");
< //file_put_contents('zav.zav', ' ' . $ptis);
< }
< //file_put_contents('zaw.zaw', '' . $ptis);
< } else {
327d163
< }
329,332c165
< if ($mbd != "") {
< $tdt=str_replace('(','',str_replace(')','',$mbd));
< $tutdate=' (' . substr($tdt,6,2) . ' ' . str_replace("01","January",str_replace("02","February",str_replace("03","March",str_replace("04","April",str_replace("05","May",str_replace("06","June",str_replace("07","July",str_replace("08","August",str_replace("09","September",str_replace("10","October",str_replace("11","November",str_replace("12","December",substr($tdt,4,2))))))))))))) . ' ' . substr($tdt,0,4) . ')';
< } else if (strpos($ideaarray[-1 + $huhrand], 'MyNew-') !== false) {
---
> if (strpos($ideaarray[-1 + $huhrand], 'MyNew-') !== false) {
335d167
< //if ($mbd != "") { file_put_contents('zak.zak', '' . $tutdate); }
342d173
< //if ($mbd != "") { file_put_contents('zam.zam', '' . $tutdate); }
351d181
< if ($mbd != "") { $ptis=explode(' (', $ptis)[0]; }
… in conjunction with small changes amongst the RJM Programming landing pages …
<span style="cursor:pointer;font-size:18px;" title="Open a random date WordPress Blog post" onclick="window.open('//www.rjmprogramming.com.au/ITblog/500/500?random=' + Math.floor(Math.random() * 19875643) + '&andclickme=y','_blank','top=20,left=100,width=900,height=800');"> 📅</span><sup onclick="var thuh=prompt('Optionally enter a topic of interest you find in the relevant blog posting title where you can use comma delimiter for a list of find strings or semicolon for list of find strings in nominated order, else for no RJM Programming blog navigations click/tap Cancel. An 8 numeric YYYYMMDD entry will look at that date.',' '); if (thuh != null) { if (thuh.trim().length == 8 && thuh.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,'') == '') { window.open('//www.rjmprogramming.com.au/ITblog/500/500?random=' + Math.floor(Math.random() * 19875643) + '&andclickme=y&mustbedated=' + encodeURIComponent(thuh.trim()),'_blank','top=20,left=100,width=900,height=800'); } else if (thuh.trim() == '') { window.open('//www.rjmprogramming.com.au/ITblog/500/500?random=' + Math.floor(Math.random() * 19875643) + '&andclickme=y','_blank','top=20,left=100,width=900,height=800'); } else { window.open('//www.rjmprogramming.com.au/ITblog/500/500?random=' + Math.floor(Math.random() * 19875643) + '&andclickme=y&mustcontain=' + encodeURIComponent(thuh),'_blank','top=20,left=100,width=900,height=800'); } }" style="cursor:pointer;font-size:8px;" title="Open a random date WordPress Blog post filtered by your entered topic">❓</sup>
… to make all this happen.
Previous relevant Blog Posting Filtering Background Interfacing Tutorial is shown below.
With Image Pair Fitting into a Given Dimension Sources Tutorial, below, we identified this WordPress Blog’s TwentyTen theme’s 404.php code as (an example of) …
“code lazy (for us)” “intervention points” that mean most of the hard part of the job is done for you
… means by which we could mimic a little of the brilliant Lorem Picsum‘s modus operandi providing a random image resource, providing our own inhouse RJM Programming WordPress Blog Posting Image resource.
Since then, we’ve leant on that start, nuancing it to allow “filtering” of that total “RJM Programming WordPress Blog Posting Image resource” dataset via a user nominated string that should appear in the Blog Posting Title. This led us, in Landing Page Random Blog Post Topic Link Tutorial to make the change …
<option id='MyNew-20110314' onclick='windowopen("//www.rjmprogramming.com.au/wordpress/?p=58&pp=&pn=&title=News_from_RJM_Programming","_blank"); ' value='//www.rjmprogramming.com.au/wordpress/?p=58&pp=&pn=&title=News_from_RJM_Programming'>News from RJM Programming (20110314)</option></select></span><span style="cursor:pointer;font-size:18px;" title="Open a random date WordPress Blog post" onclick="window.open('//www.rjmprogramming.com.au/ITblog/500/500?random=' + Math.floor(Math.random() * 19875643) + '&andclickme=y','_blank','top=20,left=100,width=900,height=800');"> 📅</span><sup onclick="var thuh=prompt('Optionally enter a topic of interest you find in the relevant blog posting title, else for no RJM Programming blog navigations click/tap Cancel.',' '); if (thuh != null) { if (thuh.trim() == '') { window.open('//www.rjmprogramming.com.au/ITblog/500/500?random=' + Math.floor(Math.random() * 19875643) + '&andclickme=y','_blank','top=20,left=100,width=900,height=800'); } else { window.open('//www.rjmprogramming.com.au/ITblog/500/500?random=' + Math.floor(Math.random() * 19875643) + '&andclickme=y&mustcontain=' + encodeURIComponent(thuh),'_blank','top=20,left=100,width=900,height=800'); } }" style="cursor:pointer;font-size:8px;" title="Open a random date WordPress Blog post filtered by your entered topic">❓</sup></p>
… these days, on Landing Pages appearing like 📅❓, as an example of how we interface the new 404.php “background helper” changes, below, into (one example of) “forward user interfacer” user of that “background helper” with its new code parts below …
<?php
// WordPress "codex" PHP comments precede
$ioff=0;
$imfnameafterdomainsep="random_background_fadeinout.jpg";
$ptitle="Random Background Webpage Fade Tutorial (10 May 2022)";
$bonl="";
$tonl="";
$mcs=[];
$mcss=[];
$bigmc="";
function selectNewBlogPostingTutorialPicture() {
global $imfnameafterdomainsep, $ptitle, $bonl, $tonl, $mcs, $mcss;
$forcedhuh=-1;
$fhuhs=[];
$mc="";
$mcs=[];
$mcss=[];
$isregexp=false;
$numf=[];
$foundipath="";
$icontis=file_get_contents(explode('ITblog' . DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR)[0] . "index.html");
$ideaarray=explode('&pp=&pn=&title=', $icontis);
if (sizeof($ideaarray) <= 1) {
$imfnameafterdomainsep="random_background_fadeinout.jpg";
$ptitle="Random Background Webpage Fade Tutorial (10 May 2022)";
} else if (sizeof($ideaarray) > 1) {
if (isset($_GET['mustcontain'])) {
if (strlen(trim($_GET['mustcontain'])) > 0) {
$mc=str_replace('@#$','',str_replace(' ','+ ',str_replace(' @#$','++',str_replace(' ','++ ',(str_replace('+', ' ', urldecode($_GET['mustcontain']))) . '@#$'))));
$bigmc=str_replace(";","*",str_replace(",","*",$mc));
if (@preg_match($mc, null) === false) { // not regexp
if (strpos($mc, ",") !== false || strpos($mc, ";") !== false) {
if (strpos($mc, ';') !== false) {
$mcss=explode(";", $mc);
$mc=$mcss[0];
} else {
$mcs=explode(",", $mc);
$mc=$mcs[0];
}
}
$mc=strtolower($mc);
$numf=explode($mc, strtolower(explode($ideaarray[0], $icontis)[1]));
} else { // regexp
$isregexp=true;
$numf[0]=$icontis;
}
if (sizeof($numf) > 1 || $isregexp) { // && sizeof($numf) < 10) {
$jmc=(-1 + sizeof(explode('&pp=&pn=&title=', $numf[0])));
for ($imc=$jmc; $imc<sizeof($ideaarray); $imc++) {
if ($oktoloop) {
if (!$isregexp) {
$allok=true;
if (sizeof($mcs) > 1) {
for ($sdf=1; $sdf<sizeof($mcs); $sdf++) {
if (strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcs[$sdf]) === false) {
$allok=false;
}
}
} elseif (sizeof($mcss) > 1) {
for ($sdf=1; $sdf<sizeof($mcss); $sdf++) {
if ($allok) {
if (strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcss[$sdf]) === false) {
$allok=false;
} else {
if (strpos(strtolower($ideaarray[$imc]), strtolower($mc)) !== false) {
if (strpos(strtolower($ideaarray[$imc]), strtolower($mc)) > strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcss[$sdf])) {
$allok=false;
} else if ($sdk > 1) {
if (strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcss[$sdf]) > strpos(str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]), $mcss[-1 + $sdf])) {
$allok=false;
}
}
} else {
$allok=false;
}
}
}
}
}
if ($allok) {
if (strpos(strtolower($ideaarray[$imc]), strtolower($mc)) !== false && $allok) {
$hd=rand(2, (-1 + sizeof($ideaarray)));
$hdd=1;
if (sizeof($numf) > 20) {
$hdd=rand(2, (-1 + sizeof($ideaarray)));
}
if (($hdd % 2) == 1) {
if (($hd % 2) == 0) {
array_push($fhuhs, $imc);
} else {
array_unshift($fhuhs, $imc);
}
}
}
}
} else if ($isregexp) {
//$arrsp=preg_split($mc, explode(">", $ideaarray[$imc])[0]);
//$arrsp=preg_split('/Javascript/', str_replace('_',' ',explode(">", $ideaarray[$imc])[0]));
//if (!$arrsp) { $arrsp=[]; }
$mystr=str_replace('_',' ',explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]);
if (preg_match($mc, $mystr)) { // !== false) {
//if (sizeof($arrsp) > 1) {
if ($isregexp) { file_put_contents('iregtwo.found', '/Javascript/' . $mc . ' ... 1 ... ' . explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]); }
$hd=rand(2, (-1 + sizeof($ideaarray)));
$hdd=1;
if (sizeof($numf) > 20) {
$hdd=rand(2, (-1 + sizeof($ideaarray)));
}
if (($hdd % 2) == 1) {
if (($hd % 2) == 0) {
array_push($fhuhs, $imc);
} else {
array_unshift($fhuhs, $imc);
}
}
} else {
file_put_contents('jregtwo.found', '/Javascript/' . $mc . ' ... ' . ' ... ' . explode('"',explode("'",explode(">", $ideaarray[$imc])[0])[0])[0]);
}
}
if (sizeof($fhuhs) == 20) { break; }
}
}
}
if (sizeof($fhuhs) > 0) {
$forcedhuh=$fhuhs[0];
if (sizeof($fhuhs) == 1 && $imc > (sizeof($ideaarray) / 2)) {
$oktoloop=false; //break;
}
}
}
}
if (trim($mc) != "" && $forcedhuh == -1 && sizeof($numf) <= 1 && sizeof($fhuhs) == 0) {
$imfnameafterdomainsep="random_background_fadeinout.jpg";
$ptitle="Random Background Webpage Fade Tutorial (10 May 2022)";
} else {
while ($foundipath == "") {
if ($forcedhuh >= 1) {
$huhrand=$forcedhuh;
array_shift($fhuhs);
if (sizeof($fhuhs) > 0) {
$forcedhuh=$fhuhs[0];
} else {
$forcedhuh=-1;
$foundipath=" ";
}
} else {
$huhrand=rand(2, (-1 + sizeof($ideaarray)));
}
$ptis="";
if (strpos(explode('>', explode('"', $ideaarray[$huhrand])[0])[0], "Tutorial") !== false) {
$ptis=str_replace('_',' ',explode('Tutorial', explode('>', explode('"', $ideaarray[$huhrand])[0])[0])[0] . "Tutorial");
}
$tutdate="";
if (strpos($ideaarray[-1 + $huhrand], 'MyNew-') !== false) {
$tdt=substr(explode('MyNew-', $ideaarray[-1 + $huhrand])[-1 + sizeof(explode('MyNew-', $ideaarray[-1 + $huhrand]))],0,8);
$tutdate=' (' . substr($tdt,6,2) . ' ' . str_replace("01","January",str_replace("02","February",str_replace("03","March",str_replace("04","April",str_replace("05","May",str_replace("06","June",str_replace("07","July",str_replace("08","August",str_replace("09","September",str_replace("10","October",str_replace("11","November",str_replace("12","December",substr($tdt,4,2))))))))))))) . ' ' . substr($tdt,0,4) . ')';
if (trim($mc) != "") {
if (!$isregexp) {
if (strpos(strtolower($ptis), $mc) === false) { $tutdate=""; }
} else {
if (!preg_match($mc, $ptis)) { $tutdate=""; }
}
}
}
$pnumis=explode('&', explode('?p=', $ideaarray[-1 + $huhrand] )[-1 + sizeof(explode('?p=', $ideaarray[-1 + $huhrand] ))])[0];
$thisbpc=file_get_contents('https://www.rjmprogramming.com.au/ITblog/?p=' . $pnumis);
if (strpos($thisbpc, ' class="wp-caption') !== false) {
$thatbpc=explode('"', explode(' src="', explode(' class="wp-caption', $thisbpc)[1])[1])[0]; // www.rjmprogramming.com.au/PHP/emoji_animation_css_block.jpg
if (strpos($thatbpc, "rjmprogramming.com.au/") !== false) {
if (strpos($thatbpc, ".jp") !== false || strpos($thatbpc, ".png") !== false || strpos($thatbpc, ".gif") !== false) {
if ($tutdate != "" && strpos($ptis, " Tutorial") !== false && strpos($ptis, " (") === false && strpos($ptis, "%") === false && strpos($ptis, "&") === false && file_exists(explode('ITblog' . DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR)[0] . explode("rjmprogramming.com.au/", $thatbpc)[1] )) {
$ptis.=$tutdate;
$foundipath=explode('ITblog' . DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR)[0] . explode("rjmprogramming.com.au/", $thatbpc)[1];
if ($foundipath != "") {
$imfnameafterdomainsep=explode("rjmprogramming.com.au/", $thatbpc)[1];
$ptitle=$ptis;
$onlme="";
if (strpos(('' . $_SERVER['QUERY_STRING']), 'andclickme=') !== false) {
if ($mc != "") {
$onlme=' onload=" window.open(' . "'//www.rjmprogramming.com.au/ITblog/?p=" . $pnumis . "','_blank','top=200,left=0,height=700,width=900'); " . '" ';
if ($isregexp) {
$zis=0;
$zzis=strlen($mc);
if (strpos(($mc . '~'), '/~') !== false) { $zzis--; }
if (strpos(('~' . $mc), '~/') !== false) { $zzis--; $zis=1; }
$onlme=str_replace('; "', '; window.open(' . "'//www.rjmprogramming.com.au/itnewblog/match/mapper.php?pm=" . urlencode(substr($mc,$zis,$zzis)) . "','_blank','top=250,left=1200,height=650,width=900'); " . '"', $onlme);
} else {
$onlme=str_replace('; "', '; window.open(' . "'//www.rjmprogramming.com.au/itnewblog/match/mapper.php?pm=" . urlencode(explode('*',$bigmc)[0]) . "','_blank','top=250,left=1200,height=650,width=900'); " . '"', $onlme);
}
} else {
$onlme=' onload=" window.open(' . "'//www.rjmprogramming.com.au/ITblog/?p=" . $pnumis . "','_blank','top=200,left=100,height=700,width=900'); " . '" ';
}
}
$bonl=$onlme . ' title=' . "'" . 'Click opens relevant blog post called ' . $ptis . ' and double click opens relevant blog post action item' . "'" . ' onclick=" window.open(' . "'//www.rjmprogramming.com.au/ITblog/?p=" . $pnumis . "','_blank'); " . '" ondblclick=" window.open(' . "'//www.rjmprogramming.com.au/slideshow.html?title=" . str_replace(urlencode('|'), '%20', urlencode(str_replace(' ','|',$ptis))) . "','_blank'); " . '"';
$tonl='<head><title>' . $ptis . '</title></head>';
}
}
}
}
}
}
}
}
}
function createScaledImage($newWidth,$newHeight,$path,$datauri) { // thanks to https://stackoverflow.com/questions/16774521/scale-image-using-php-and-maintaining-aspect-ratio
$image_name=explode(DIRECTORY_SEPARATOR, $path)[-1 + sizeof(explode(DIRECTORY_SEPARATOR, $path))];
$mime = getimagesize($path);
if ($mime['mime']=='image/png') {
$src_img = imagecreatefrompng($path);
}
if ($mime['mime']=='image/jpg' || $mime['mime']=='image/jpeg' || $mime['mime']=='image/pjpeg') {
$src_img = imagecreatefromjpeg($path);
}
if ($mime['mime']=='image/gif') {
$src_img = imagecreatefromgif($path);
}
$old_x = imageSX($src_img);
$old_y = imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w = $newWidth;
$thumb_h = $old_y/$old_x*$newWidth;
}
if ($old_x < $old_y) {
$thumb_w = $old_x/$old_y*$newHeight;
$thumb_h = $newHeight;
}
if ($old_x == $old_y) {
$thumb_w = $newWidth;
$thumb_h = $newHeight;
}
$dst_img = imagecreatetruecolor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
// New save location
$new_thumb_loc = '/tmp/' . $image_name;
if (!$datauri) {
if($mime['mime']=='image/png') {
header('Content-Type: image/png');
imagepng($dst_img); //,$new_thumb_loc,8);
if (file_exists($new_thumb_loc)) {
unlink($new_thumb_loc);
}
imagedestroy($dst_img);
imagedestroy($src_img);
exit;
} else if ($mime['mime']=='image/jpg' || $mime['mime']=='image/jpeg' || $mime['mime']=='image/pjpeg') {
header('Content-Type: image/jpeg');
imagejpeg($dst_img); //,$new_thumb_loc,80);
if (file_exists($new_thumb_loc)) {
unlink($new_thumb_loc);
}
imagedestroy($dst_img);
imagedestroy($src_img);
exit;
} else if ($mime['mime']=='image/gif') {
header('Content-Type: image/gif');
imagegif($dst_img); //,$new_thumb_loc,80);
if (file_exists($new_thumb_loc)) {
unlink($new_thumb_loc);
}
imagedestroy($dst_img);
imagedestroy($src_img);
exit;
}
exit;
}
$result="";
if ($mime['mime']=='image/png') {
imagepng($dst_img,$new_thumb_loc,8);
$result = file_get_contents($new_thumb_loc);
}
if ($mime['mime']=='image/jpg' || $mime['mime']=='image/jpeg' || $mime['mime']=='image/pjpeg') {
imagejpeg($dst_img,$new_thumb_loc,80);
$result = file_get_contents($new_thumb_loc);
}
if ($mime['mime']=='image/gif') {
imagegif($dst_img,$new_thumb_loc);
$result = file_get_contents($new_thumb_loc);
}
imagedestroy($dst_img);
imagedestroy($src_img);
if (file_exists($new_thumb_loc)) {
unlink($new_thumb_loc);
}
return $result;
}
?>
… called within “new if section URL analysis code” …
<?php
$uparts=explode("/", $_SERVER['REQUEST_URI']);
if (sizeof($uparts) >= 2) {
if (trim(explode('#',explode('?',$uparts[-1 + sizeof($uparts)])[0])[0]) == '') {
$ioff=-1;
}
if (1 == 1 || ('' . $_SERVER['QUERY_STRING']) == '') {
$usz=sizeof($uparts);
if (str_replace('?' . $_SERVER['QUERY_STRING'],'',trim($uparts[-1 + sizeof($uparts)])) == '') { $usz--; }
if ($usz == 3 && strpos($uparts[-1 + $usz], "%20") !== false || strpos($uparts[-1 + $usz], "+") !== false) { // fix /ITblog/Linux%20mailx%20Primer%20Tutorial/ 18/1/2022 RM
$oky=true;
if (substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) <= '9') {
if (substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) <= '9') {
$oky=false;
}
}
if ($oky) {
if (('' . $_SERVER['QUERY_STRING']) == '') {
header('Location: ' . str_replace('~``','/ITblog/',str_replace('/','',str_replace('/ITBLOG/','~``',str_replace('/itblog/','~``',str_replace('/ITblog/','~``',str_replace('--','-',str_replace('---','-',str_replace('+','-',str_replace('%20','-',$_SERVER['REQUEST_URI']))))))))));
} else {
header('Location: ' . explode('?',str_replace('~``','/ITblog/',str_replace('/','',str_replace('/ITBLOG/','~``',str_replace('/itblog/','~``',str_replace('/ITblog/','~``',str_replace('--','-',str_replace('---','-',str_replace('+','-',str_replace('%20','-',$_SERVER['REQUEST_URI']))))))))))[0] . '?' . $_SERVER['QUERY_STRING']);
}
exit;
}
}
}
if (str_replace("category","cat",strtolower($uparts[-2 + sizeof($uparts)])) == "cat" || strtolower($uparts[-2 + sizeof($uparts)]) == "category") {
$catsare=["","Not Categorised","Ajax","Android","Animation","Anything You Like","Code::Blocks","Colour Matching","Data Integration","Database","Delphi","Eclipse","eLearning","ESL","Event-Driven Programming","Games","GIMP","GUI","Hradware","Installers","iOS","Land Surveying","Moodle","Music Poll","NetBeans","Networking","News","ontop","OOP","Operating System","Photography","Projects","Signage Poll","Software","SpectroPhotometer","Tiki Wiki","Trips","Tutorials","Uncategorized","Visual Studio","Xcode"];
for ($ibh=1; $ibh<sizeof($catsare); $ibh++) {
if (explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0] == strtolower($catsare[$ibh])) {
if (strtolower($catsare[$ibh]) == "ontop") {
header('Location: https://www.rjmprogramming.com.au/ITblog/category/' . str_replace(" ","-",explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0])) . '#' . $ibh;
} else {
header('Location: https://www.rjmprogramming.com.au/ITblog/category/' . str_replace(" ","-",explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0])) . '#' . $ibh;
}
} else if (explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0] == ('' . $ibh)) {
if (strtolower($catsare[$ibh]) == "ontop") {
header('Location: https://www.rjmprogramming.com.au/ITblog/?cat=' . str_replace(" ","-",explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0])) . '#' . $ibh;
} else {
header('Location: https://www.rjmprogramming.com.au/ITblog/?cat=' . str_replace(" ","-",explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0])) . '#' . $ibh;
}
}
}
} else if (substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) <= '9') {
if (substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) <= '9') {
$uwidth=trim($uparts[$ioff - 2 + sizeof($uparts)]);
$uheight=trim(explode('#',explode('?',$uparts[$ioff - 1 + sizeof($uparts)])[0])[0]);
$imfnameafterdomainsep="random_background_fadeinout.jpg";
$ptitle="Random Background Webpage Fade Tutorial";
selectNewBlogPostingTutorialPicture();
$postingiurl=explode('ITblog' . DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR)[0] . $imfnameafterdomainsep;
list($iwidth, $iheight, $itype, $iattr) = getimagesize($postingiurl);
$amime = getimagesize($postingiurl);
if ($ioff == 0) {
//header('Content-Type: image/jpeg');
echo "<html>" . $tonl . "<body" . $bonl . "><pre>data:image/jpeg;base64," . base64_encode(createScaledImage($uwidth,$uheight,$postingiurl,true)) . "#" . str_replace('+','%20',urlencode($ptitle)) . "</pre></body></html>";
} else if (1 == 2) {
//header('Content-Type: image/jpeg');
echo '<img src="' . "data:image/jpeg;base64," . base64_encode(file_get_contents($postingiurl)) . "#" . str_replace('+','%20',urlencode($ptitle)) . '"></img>';
} else {
createScaledImage($uwidth,$uheight,$postingiurl,false); //imagecreatefromjpeg($postingiurl);
}
exit;
}
}
}
get_header(); ?>
// more WordPress "codex" PHP code follows
?>
Previous relevant Image Pair Fitting into a Given Dimension Sources Tutorial is shown below.
Thinking “layers of functionality” here, we think that progress onto yesterday’s Image Pair Fitting into a Given Dimension Primer Tutorial would go …
- as well as the wonderful Lorem Picsum resource for beautiful images “source” … we might add …
- new RJM Programming WordPress Blog (that you are probably reading from, now) tutorial picture “source” of images
… the functionality for which we have been trying to envisage for many years, and seeing the excellent Lorem Picsum arrangements being a catalyst, to give it a go.
Kludgy feeling or not, we are happy to be linking into the “last talked about” WordPress Blog Search Within Search Posting Progress Context Tutorial WordPress “URL not found” 404.php code methodologies here, as a great “intervention point”. We often find the biggest joy in web application code modifications is to identify “code lazy (for us)” “intervention points” that mean most of the hard part of the job is done for you, by others (here, that being the great WordPress TwentyTen theme “codex” PHP code helped out by Apache web server .htaccess permalink configurations) before you add your own “situation specific” interventional code.
And so, once at 404.php code, we add new global variables and functions …
<?php
// WordPress "codex" PHP comments precede
$ioff=0;
$imfnameafterdomainsep="random_background_fadeinout.jpg";
$ptitle="Random Background Webpage Fade Tutorial";
$bonl="";
$tonl="";
function selectNewBlogPostingTutorialPicture() {
global $imfnameafterdomainsep, $ptitle, $bonl, $tonl;
$foundipath="";
$icontis=file_get_contents(explode('ITblog' . DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR)[0] . "index.html");
$ideaarray=explode('&pp=&pn=&title=', $icontis);
if (sizeof($ideaarray) > 1) {
while ($foundipath == "") {
$huhrand=rand(2, (-1 + sizeof($ideaarray)));
$ptis="";
if (strpos(explode('>', explode('"', $ideaarray[$huhrand])[0])[0], "Tutorial") !== false) {
$ptis=str_replace('_',' ',explode('Tutorial', explode('>', explode('"', $ideaarray[$huhrand])[0])[0])[0] . "Tutorial");
}
$tutdate="";
if (strpos($ideaarray[-1 + $huhrand], 'MyNew-') !== false) {
$tdt=substr(explode('MyNew-', $ideaarray[-1 + $huhrand])[-1 + sizeof(explode('MyNew-', $ideaarray[-1 + $huhrand]))],0,8);
$tutdate=' (' . substr($tdt,6,2) . ' ' . str_replace("01","January",str_replace("02","February",str_replace("03","March",str_replace("04","April",str_replace("05","May",str_replace("06","June",str_replace("07","July",str_replace("08","August",str_replace("09","September",str_replace("10","October",str_replace("11","November",str_replace("12","December",substr($tdt,4,2))))))))))))) . ' ' . substr($tdt,0,4) . ')';
}
$pnumis=explode('&', explode('?p=', $ideaarray[-1 + $huhrand] )[-1 + sizeof(explode('?p=', $ideaarray[-1 + $huhrand] ))])[0];
$thisbpc=file_get_contents('HTTP://www.rjmprogramming.com.au/ITblog/?p=' . $pnumis);
if (strpos($thisbpc, ' class="wp-caption') !== false) {
$thatbpc=explode('"', explode(' src="', explode(' class="wp-caption', $thisbpc)[1])[1])[0]; // www.rjmprogramming.com.au/PHP/emoji_animation_css_block.jpg
if (strpos($thatbpc, "rjmprogramming.com.au/") !== false) {
if (strpos($thatbpc, ".jp") !== false || strpos($thatbpc, ".png") !== false || strpos($thatbpc, ".gif") !== false) {
if ($tutdate != "" && strpos($ptis, " Tutorial") !== false && strpos($ptis, " (") === false && strpos($ptis, "%") === false && strpos($ptis, "&") === false && file_exists(explode('ITblog' . DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR)[0] . explode("rjmprogramming.com.au/", $thatbpc)[1] )) {
$ptis.=$tutdate;
$foundipath=explode('ITblog' . DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR)[0] . explode("rjmprogramming.com.au/", $thatbpc)[1];
if ($foundipath != "") {
$imfnameafterdomainsep=explode("rjmprogramming.com.au/", $thatbpc)[1];
$ptitle=$ptis;
$onlme="";
if (strpos(('' . $_SERVER['QUERY_STRING']), 'andclickme=') !== false) {
$onlme=' onload=" window.open(' . "'//www.rjmprogramming.com.au/ITblog/?p=" . $pnumis . "','_blank','top=200,left=100,height=700,width=900'); " . '" ';
}
$bonl=$onlme . ' title=' . "'" . 'Click opens relevant blog post called ' . $ptis . ' and double click opens relevant blog post action item' . "'" . ' onclick=" window.open(' . "'//www.rjmprogramming.com.au/ITblog/?p=" . $pnumis . "','_blank'); " . '" ondblclick=" window.open(' . "'//www.rjmprogramming.com.au/slideshow.html?title=" . str_replace(urlencode('|'), '%20', urlencode(str_replace(' ','|',$ptis))) . "','_blank'); " . '"';
$tonl='<head><title>' . $ptis . '</title></head>';
}
}
}
}
}
}
}
}
function createScaledImage($newWidth,$newHeight,$path,$datauri) { // thanks to https://stackoverflow.com/questions/16774521/scale-image-using-php-and-maintaining-aspect-ratio
$image_name=explode(DIRECTORY_SEPARATOR, $path)[-1 + sizeof(explode(DIRECTORY_SEPARATOR, $path))];
$mime = getimagesize($path);
if ($mime['mime']=='image/png') {
$src_img = imagecreatefrompng($path);
}
if ($mime['mime']=='image/jpg' || $mime['mime']=='image/jpeg' || $mime['mime']=='image/pjpeg') {
$src_img = imagecreatefromjpeg($path);
}
if ($mime['mime']=='image/gif') {
$src_img = imagecreatefromgif($path);
}
$old_x = imageSX($src_img);
$old_y = imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w = $newWidth;
$thumb_h = $old_y/$old_x*$newWidth;
}
if ($old_x < $old_y) {
$thumb_w = $old_x/$old_y*$newHeight;
$thumb_h = $newHeight;
}
if ($old_x == $old_y) {
$thumb_w = $newWidth;
$thumb_h = $newHeight;
}
$dst_img = imagecreatetruecolor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
// New save location
$new_thumb_loc = '/tmp/' . $image_name;
if (!$datauri) {
if($mime['mime']=='image/png') {
header('Content-Type: image/png');
imagepng($dst_img); //,$new_thumb_loc,8);
if (file_exists($new_thumb_loc)) {
unlink($new_thumb_loc);
}
imagedestroy($dst_img);
imagedestroy($src_img);
exit;
} else if ($mime['mime']=='image/jpg' || $mime['mime']=='image/jpeg' || $mime['mime']=='image/pjpeg') {
header('Content-Type: image/jpeg');
imagejpeg($dst_img); //,$new_thumb_loc,80);
if (file_exists($new_thumb_loc)) {
unlink($new_thumb_loc);
}
imagedestroy($dst_img);
imagedestroy($src_img);
exit;
} else if ($mime['mime']=='image/gif') {
header('Content-Type: image/gif');
imagegif($dst_img); //,$new_thumb_loc,80);
if (file_exists($new_thumb_loc)) {
unlink($new_thumb_loc);
}
imagedestroy($dst_img);
imagedestroy($src_img);
exit;
}
exit;
}
$result="";
if ($mime['mime']=='image/png') {
imagepng($dst_img,$new_thumb_loc,8);
$result = file_get_contents($new_thumb_loc);
}
if ($mime['mime']=='image/jpg' || $mime['mime']=='image/jpeg' || $mime['mime']=='image/pjpeg') {
imagejpeg($dst_img,$new_thumb_loc,80);
$result = file_get_contents($new_thumb_loc);
}
if ($mime['mime']=='image/gif') {
imagegif($dst_img,$new_thumb_loc);
$result = file_get_contents($new_thumb_loc);
}
imagedestroy($dst_img);
imagedestroy($src_img);
if (file_exists($new_thumb_loc)) {
unlink($new_thumb_loc);
}
return $result;
}
?>
… called within “new if section URL analysis code” …
<?php
$uparts=explode("/", $_SERVER['REQUEST_URI']);
if (sizeof($uparts) >= 2) {
if (trim(explode('#',explode('?',$uparts[-1 + sizeof($uparts)])[0])[0]) == '') {
$ioff=-1;
}
if (1 == 1 || ('' . $_SERVER['QUERY_STRING']) == '') {
$usz=sizeof($uparts);
if (str_replace('?' . $_SERVER['QUERY_STRING'],'',trim($uparts[-1 + sizeof($uparts)])) == '') { $usz--; }
if ($usz == 3 && strpos($uparts[-1 + $usz], "%20") !== false || strpos($uparts[-1 + $usz], "+") !== false) { // fix /ITblog/Linux%20mailx%20Primer%20Tutorial/ 18/1/2022 RM
if (('' . $_SERVER['QUERY_STRING']) == '') {
header('Location: ' . str_replace('~``','/ITblog/',str_replace('/','',str_replace('/ITBLOG/','~``',str_replace('/itblog/','~``',str_replace('/ITblog/','~``',str_replace('--','-',str_replace('---','-',str_replace('+','-',str_replace('%20','-',$_SERVER['REQUEST_URI']))))))))));
} else {
header('Location: ' . explode('?',str_replace('~``','/ITblog/',str_replace('/','',str_replace('/ITBLOG/','~``',str_replace('/itblog/','~``',str_replace('/ITblog/','~``',str_replace('--','-',str_replace('---','-',str_replace('+','-',str_replace('%20','-',$_SERVER['REQUEST_URI']))))))))))[0] . '?' . $_SERVER['QUERY_STRING']);
}
exit;
}
}
if (str_replace("category","cat",strtolower($uparts[-2 + sizeof($uparts)])) == "cat" || strtolower($uparts[-2 + sizeof($uparts)]) == "category") {
$catsare=["","Not Categorised","Ajax","Android","Animation","Anything You Like","Code::Blocks","Colour Matching","Data Integration","Database","Delphi","Eclipse","eLearning","ESL","Event-Driven Programming","Games","GIMP","GUI","Hradware","Installers","iOS","Land Surveying","Moodle","Music Poll","NetBeans","Networking","News","ontop","OOP","Operating System","Photography","Projects","Signage Poll","Software","SpectroPhotometer","Tiki Wiki","Trips","Tutorials","Uncategorized","Visual Studio","Xcode"];
for ($ibh=1; $ibh<sizeof($catsare); $ibh++) {
if (explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0] == strtolower($catsare[$ibh])) {
if (strtolower($catsare[$ibh]) == "ontop") {
header('Location: https://www.rjmprogramming.com.au/ITblog/category/' . str_replace(" ","-",explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0])) . '#' . $ibh;
} else {
header('Location: https://www.rjmprogramming.com.au/ITblog/category/' . str_replace(" ","-",explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0])) . '#' . $ibh;
}
} else if (explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0] == ('' . $ibh)) {
if (strtolower($catsare[$ibh]) == "ontop") {
header('Location: https://www.rjmprogramming.com.au/ITblog/?cat=' . str_replace(" ","-",explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0])) . '#' . $ibh;
} else {
header('Location: https://www.rjmprogramming.com.au/ITblog/?cat=' . str_replace(" ","-",explode("&",strtolower($uparts[-1 + sizeof($uparts)]))[0])) . '#' . $ibh;
}
}
}
} else if (substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 1 + sizeof($uparts)]) . ' ',0,1) <= '9') {
if (substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) >= '0' && substr(trim($uparts[$ioff - 2 + sizeof($uparts)]) . ' ',0,1) <= '9') {
$uwidth=trim($uparts[$ioff - 2 + sizeof($uparts)]);
$uheight=trim(explode('#',explode('?',$uparts[$ioff - 1 + sizeof($uparts)])[0])[0]);
$imfnameafterdomainsep="random_background_fadeinout.jpg";
$ptitle="Random Background Webpage Fade Tutorial";
selectNewBlogPostingTutorialPicture();
$postingiurl=explode('ITblog' . DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR)[0] . $imfnameafterdomainsep;
list($iwidth, $iheight, $itype, $iattr) = getimagesize($postingiurl);
$amime = getimagesize($postingiurl);
if ($ioff == 0) {
echo "<html>" . $tonl . "<body" . $bonl . "><pre>data:image/jpeg;base64," . base64_encode(createScaledImage($uwidth,$uheight,$postingiurl,true)) . "#" . str_replace('+','%20',urlencode($ptitle)) . "</pre></body></html>";
} else if (1 == 2) {
echo '<img src="' . "data:image/jpeg;base64," . base64_encode(file_get_contents($postingiurl)) . "#" . str_replace('+','%20',urlencode($ptitle)) . '"></img>';
} else {
createScaledImage($uwidth,$uheight,$postingiurl,false); //imagecreatefromjpeg($postingiurl);
}
exit;
}
}
}
get_header(); ?>
// more WordPress "codex" PHP code follows
?>
… that amount to changes which enable two types of newly functional URLs that, without the changes, used to result in a WordPress webpage explaining that the URL could not be found …
- a URL such as https://www.rjmprogramming.com.au/ITblog/537/500 will pick a random RJM Programming Blog tutorial picture and show …
[image data URI of tutorial picture]#[blog posting title]
… along with the happy discovery along the way that the “#[blog posting title]” can be tagged onto a base64 data URI and still successfully display the image - whereas a URL such as https://www.rjmprogramming.com.au/ITblog/537/500/ will pick a random RJM Programming Blog tutorial picture and show it
… the combination allowing our changed proof of concept CSS (styling) “object-fit” experimenting web application to be now allowing for two sources of image data which the user can select between, themselves, with the RJM Programming WordPress Blog images also containing clickable links back to the WordPress Blog post of relevance. You can also try this here.
Stop Press
And then there is some optional filtering of RJM Programming blog image topic, as we make happen with our changed proof of concept CSS (styling) “object-fit” experimenting web application.
Previous relevant Image Pair Fitting into a Given Dimension Primer Tutorial is shown below.
One of the most “catered for” part of webpage design involves the display of images. Our recent “stumbling upon” …
- the excellent Lorem Picsum resource for beautiful images suiting a given width x height … had us looking around for an interesting image related theme to “tutorialize” and “stumbled upon” …
- the excellent CSS object-fit Property explanation of CSS “object-fit” property …
… facilitating the interest in the scenario …
- you are presented with “webpage real estate” of a given width x height … into which …
- you want to display two images side by side …
… and in this scenario the use of “object-fit” property values …
Here is where the object-fit property comes in. The object-fit property can take one of the following values:
fill – This is default. The image is resized to fill the given dimension. If necessary, the image will be stretched or squished to fit
contain – The image keeps its aspect ratio, but is resized to fit within the given dimension
cover – The image keeps its aspect ratio and fills the given dimension. The image will be clipped to fit
none – The image is not resized
scale-down – the image is scaled down to the smallest version of none or contain
… creates interesting variety in how you can configure this scenario depending on your (constraint) interest in …
- you are constrained by fact you must see all the image’s content in original aspect ratio … think … contain or scale-down
- you are constrained by fact you must see all the image’s content but not necessarily with original aspect ratio … think … fill or contain or scale-down
- you are constrained by fact that your “webpage real estate” of the given width x height must be filled (by imagery) … think … fill or cover (or (quite often, but not always) none)
- you must keep original image dimensions but clipping okay … think … none
- you must keep original aspect ratio of images but clipping okay … think … contain or cover or none or scale-down
… and then there is …
What happens when you resize your webpage window?
Feel free to try our proof of concept CSS (styling) “object-fit” experimenting web application …
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.