{"id":63485,"date":"2024-04-29T03:01:38","date_gmt":"2024-04-28T17:01:38","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=63485"},"modified":"2024-04-29T08:21:22","modified_gmt":"2024-04-28T22:21:22","slug":"colouring-in-drag-and-drop-mobile-postcard-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/colouring-in-drag-and-drop-mobile-postcard-tutorial\/","title":{"rendered":"Colouring In Drag and Drop Mobile Postcard Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/HTMLCSS\/colouring_in_was_numbers_guessing_game.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Colouring In Drag and Drop Mobile Postcard Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/postcard_again.gif\" title=\"Colouring In Drag and Drop Mobile Postcard Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Colouring In Drag and Drop Mobile Postcard Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/colouring-in-drag-and-drop-postcard-tutorial\/' title='Colouring In Drag and Drop Postcard Tutorial'>Colouring In Drag and Drop Postcard Tutorial<\/a> mentioned two issues with its Postcard creation functionalities that needed further attention &#8230;<\/p>\n<blockquote cite='https:\/\/www.rjmprogramming.com.au\/ITblog\/colouring-in-drag-and-drop-postcard-tutorial\/'><p>\nWe have more work to do regarding data limits (even with hashtagging) using mobile platforms and the Take Photo idea, and we have some text positioning to fix also &#8230;\n<\/p><\/blockquote>\n<p> &#8230; and today we look into that a bit more.<\/p>\n<p>Regarding <i>&#8220;We have more work to do regarding data limits (even with hashtagging) using mobile platforms&#8221;<\/i> we were finding the &#8220;Take Photo&#8221; iOS Camera app functionality was producing images of more than 3000&#215;4000 and as such, though amazingly it can still work in non-mobile, we were not surprised it didn&#8217;t work when shaping to create the mainly hashtagged email link required to share a Postcard with an emailee (ie. email recipient).  So <font color=blue>we did some pruning<\/font> &#8230;<\/p>\n<p><code><br \/>\n<font color=blue>var lesserinurl='';<\/font><br \/>\n<br \/>\nfunction checkspag() {<br \/>\n  <font color=blue>if (navigator.userAgent.match(\/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile\/i) && document.getElementById('result').innerHTML.trim() != '' && lesserinurl == '' && document.getElementById('result').innerHTML.indexOf('data:') == 0) {<br \/>\n  newimg=document.createElement('img');<br \/>\n  newimg.onload = function() {<br \/>\n    \/\/ draw the image onto the canvas<br \/>\n    \/\/alert(11);<br \/>\n    newcanvas=document.getElementById('mymobilecanvas'); \/\/document.createElement('canvas');<br \/>\n    \/\/alert(111);<br \/>\n    if (newimg.width > 800) {<br \/>\n    newcanvas.width=800;<br \/>\n    newcanvas.height=Math.round(newimg.height * 800 \/ newimg.width);<br \/>\n    \/\/alert('Wh=' + newcanvas.width + 'x' + newcanvas.height);<br \/>\n    newcanvas.getContext('2d').drawImage(newimg, 0, 0, newimg.width, newimg.height, 0, 0, newcanvas.width, newcanvas.height);<br \/>\n    } else {<br \/>\n    newcanvas.width=newimg.width;<br \/>\n    \/\/alert('' + newimg.width + 'x' + newimg.height);<br \/>\n    newcanvas.height=newimg.height;<br \/>\n    \/\/alert('wh=' + newcanvas.width + 'x' + newcanvas.height);<br \/>\n    newcanvas.getContext('2d').drawImage(newimg, 0, 0);<br \/>\n    }<br \/>\n    lesserinurl=newcanvas.toDataURL('image\/jpeg', 0.1);<br \/>\n    document.getElementById('result').innerHTML=lesserinurl;<br \/>\n    \/\/document.getElementById('inurl').value=lesserinurl;<br \/>\n    \/\/alert(lesserinurl);<br \/>\n    \/\/document.getElementById('inurl').blur();<br \/>\n  }<br \/>\n  newimg.src = document.getElementById('result').innerHTML;<br \/>\n    setTimeout(checkspag, 5000);<br \/>\n  } else <\/font>if (document.getElementById('result').innerHTML.trim() != '' && multistyle == '') {<br \/>\n    imdu=document.getElementById('result').innerHTML.trim();<br \/>\n    document.getElementById('result').innerHTML='';<br \/>\n    document.getElementById('cbi').src='\/HTMLCSS\/client_browsing.htm?d=' + Math.floor(Math.random() * 1987867564) + '&wording=Allimages%20images%2E%20';<br \/>\n    \/\/alert('<sty' + 'le> #mytable { background:linear-gradient(rgba(255,255,255,' + eval(1.0 - document.getElementById('opmeter').value).toPrecision(2) + '),rgba(255,255,255,' + eval(1.0 - document.getElementById('opmeter').value).toPrecision(2) + ')),URL(' + imdu.replace(\/\\ \/g,'+').substring(0,20) + '); background-repeat:no-repeat; background-size:contain; } <\/sty' + 'le>');<br \/>\n    if (document.getElementById('ddstyle')) {<br \/>\n    if (document.getElementById('ddstyle').innerHTML.indexOf(imdu) == -1) {<br \/>\n    document.getElementById('ddstyle').innerHTML='<sty' + 'le> #mytable { background-image:linear-gradient(rgba(255,255,255,' + eval(1.0 - document.getElementById('opmeter').value).toPrecision(2) + '),rgba(255,255,255,' + eval(1.0 - document.getElementById('opmeter').value).toPrecision(2) + ')),URL(' + imdu.replace(\/\\ \/g,'+') + '); background-repeat:no-repeat; background-size:contain; } <\/sty' + 'le>';<br \/>\n    }<br \/>\n    } else {<br \/>\n    if (document.getElementById('dstyle').innerHTML.indexOf(imdu) == -1) {<br \/>\n\/\/alert('Here');<br \/>\n    document.getElementById('dstyle').innerHTML+='<sty' + 'le> #mytable { background-image:linear-gradient(rgba(255,255,255,' + eval(1.0 - document.getElementById('opmeter').value).toPrecision(2) + '),rgba(255,255,255,' + eval(1.0 - document.getElementById('opmeter').value).toPrecision(2) + ')),URL(' + imdu.replace(\/\\ \/g,'+') + '); background-repeat:no-repeat; background-size:contain; } <\/sty' + 'le>';<br \/>\n    }<br \/>\n    }<br \/>\n    setTimeout(checkspag, 5000);<br \/>\n  } else {<br \/>\n    setTimeout(checkspag, 5000);<br \/>\n  }<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; using the great HTML5 <a target=_blank title='HTML Canvas element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>canvas<\/a> element invention, and found it could send such a pruned down postcard, though we are not ruling out future tweaks that may add back some resolution and size into the future.  We&#8217;ll see.<\/p>\n<p>And regarding <i>&#8220;we have some text positioning to fix&#8221;<\/i>, our hunch about the offset needed to fix being the (opposite of the) amount to the top of the imagery in a normal Colouring In webpage, <font color=blue>panned out<\/font> &#8230;<\/p>\n<p><code><br \/>\n var postcard=false;<br \/>\n var origmytablerect=null;<br \/>\n <br \/>\n         setTimeout(function(){<br \/>\n          <font color=blue>origmytablerect=document.getElementById('mytable').getBoundingClientRect();<\/font><br \/>\n          console.log('356:' + origmytablerect.top);<br \/>\n          var woois=window.open('', '_blank', 'top=50,left=50,width=800,height=800');<br \/>\n          if (1 == 1) {<br \/>\n          woois.document.write('&lt;html&gt;' + document.head.outerHTML.replace('postc' + 'ard=false', 'postc' + 'ard=true') + document.body.outerHTML + '&lt;\/html&gt;');<br \/>\n          \/\/origmytablerect=woois.document.getElementById('mytable').getBoundingClientRect();<br \/>\n          \/\/console.log('56:' + origmytablerect.top);<br \/>\n          <font color=blue>if (eval('' + origmytablerect.top) &gt; 0) {<br \/>\n             var wasthetop=0, thespans=woois.document.getElementsByTagName('span');<br \/>\n             for (var iispans=0; iispans&lt;thespans.length; iispans++) {<br \/>\n               if (thespans[iispans].outerHTML.indexOf('absolute;') != -1 && thespans[iispans].outerHTML.indexOf('top:') != -1) {<br \/>\n               console.log('10:' + thespans[iispans].outerHTML);<br \/>\n                 wasthetop=eval('' + thespans[iispans].outerHTML.split('top:')[1].split(';')[0].replace('px','').trim());<br \/>\n                 wasthetop-=eval('' + origmytablerect.top);<br \/>\n                 thespans[iispans].style.top='' + wasthetop + 'px';<br \/>\n               }<br \/>\n             }<br \/>\n          }<\/font><br \/>\n     woois.document.getElementById('mytable').style.position='fixed';<br \/>\n     woois.document.getElementById('mytable').style.left='0px';<br \/>\n     woois.document.getElementById('mytable').style.top='0px';<br \/>\n     woois.document.getElementById('mytable').style.zIndex='23';<br \/>\n     woois.document.getElementsByTagName('h1')[0].style.display='none';<br \/>\n     woois.document.getElementsByTagName('h3')[0].style.display='none';<br \/>\n     woois.document.getElementsByTagName('h3')[1].style.display='none';<br \/>\n     woois.document.getElementsByTagName('h4')[0].style.display='none';<br \/>\n     woois.document.getElementById('spancb').style.display='none';<br \/>\n     woois.document.getElementById('dsource').style.display='none';<br \/>\n          } else {<br \/>\n          \/\/woois.document.write('&lt;html&gt;' + document.head.outerHTML + document.body.outerHTML.replace('&lt;div id=\"ta' + 'rget\"&gt;', '&lt;div id=\"ta' + 'rget\" style=\"position:fixed;top:0px;left:0px;z-index:23;\"&gt;') + '&lt;\/html&gt;');<br \/>\n          woois.document.write('&lt;html&gt;' + document.head.outerHTML + document.body.outerHTML.replace(' cellspacing=\"0\" sty' + 'le=\"', ' cellspacing=\"0\" sty' + 'le=\"position:fixed;top:0px;left:0px;z-index:23;') + '&lt;\/html&gt;');<br \/>\n          \/\/woois.document.write('&lt;html&gt;' + document.head.outerHTML + document.body.outerHTML.replace(' cellspacing=\"0\" sty' + 'le=\"', ' cellspacing=\"0\" sty' + 'le=\"margin-top:-150px;z-index:23;') + '&lt;\/html&gt;');<br \/>\n<br \/>\n     woois.document.getElementsByTagName('h1')[0].style.display='none';<br \/>\n     woois.document.getElementsByTagName('h3')[0].style.display='none';<br \/>\n     woois.document.getElementsByTagName('h3')[1].style.display='none';<br \/>\n     woois.document.getElementsByTagName('h4')[0].style.display='none';<br \/>\n     woois.document.getElementById('spancb').style.display='none';<br \/>\n     woois.document.getElementById('dsource').style.display='none';<br \/>\n         }<br \/>\n         }, 15000);<br \/>\n<\/code> <\/p>\n<p>Only <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_drag_and_drop.html-------------------------------------------------GETME\">a changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_drag_and_drop.html-------------------------------------------------GETME\">experimental_drag_and_drop.htm<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_drag_and_drop.htm\">Experimental Drag and Drop<\/a> clientside HTML and Javascript basis was needed to help out our <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/HTMLCSS\/colouring_in_was_numbers_guessing_game.php\">Colouring In<\/a> web application&#8217;s Postcard production ideas.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d63485' onclick='var dv=document.getElementById(\"d63485\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/camera\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d63485' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday&#8217;s Colouring In Drag and Drop Postcard Tutorial mentioned two issues with its Postcard creation functionalities that needed further attention &#8230; We have more work to do regarding data limits (even with hashtagging) using mobile platforms and the Take Photo &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/colouring-in-drag-and-drop-mobile-postcard-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,15,20,30,37],"tags":[2824,84,2367,126,127,2471,2472,2379,161,1993,2862,184,1580,210,4723,2503,1707,222,1604,230,2081,281,3197,4732,322,327,2365,4721,4722,359,2237,364,4717,4385,380,385,3192,2023,386,3539,2242,448,476,477,2718,482,4198,4733,2208,513,2298,3922,557,3961,2258,576,2658,578,590,4724,3554,626,630,631,4563,652,673,684,4730,2169,719,739,772,4727,795,4736,812,4301,2092,3357,830,4719,2394,3987,1666,4713,1705,894,3434,2255,1738,929,932,1918,3666,950,4731,967,2519,993,997,1986,4720,3665,2085,1022,2141,1843,2079,1991,4734,1063,4728,4737,4729,1075,1917,1133,1137,2272,1159,1200,1209,1211,1212,1226,1238,1581,1811,1254,1292,1302,1319,4351,1842,1899,1345,1350,1356,4718,4735,2257,1431,2811,4726],"class_list":["post-63485","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-games","category-ios","category-photography","category-tutorials","tag-absolute","tag-animation-2","tag-answer","tag-background","tag-background-image","tag-background-position","tag-background-repeat","tag-background-size","tag-border","tag-browse","tag-camer","tag-canvas","tag-cell","tag-class","tag-clip-art","tag-clone","tag-co-ordinates","tag-collaborate","tag-collaboration","tag-column","tag-country","tag-css","tag-dataset","tag-dblclick","tag-device","tag-did-you-know","tag-dimensions","tag-doodle","tag-doodling","tag-double-click","tag-drag","tag-drag-and-drop","tag-dragover","tag-drop","tag-email","tag-emoji","tag-emoji-flag","tag-encoding","tag-encryption","tag-entity","tag-flag","tag-focus","tag-game","tag-games-2","tag-genericize","tag-geography","tag-geojson","tag-geospatial","tag-getboundingclientrect","tag-google","tag-grid","tag-guess","tag-hashtag","tag-hashtagging","tag-height","tag-html","tag-html-entity","tag-html5","tag-image","tag-image-search","tag-image-url","tag-ios","tag-ipad","tag-iphone","tag-iso-3166-2","tag-javascript","tag-keyboard","tag-latitude","tag-left-width","tag-location-hash","tag-longitude","tag-mailto","tag-mercator","tag-mercator-projection-opacity","tag-mobile","tag-mountain","tag-mouse","tag-mouse-wheel","tag-multiple","tag-multiple-background","tag-navigation","tag-nickname","tag-number","tag-oncontextmenu","tag-ondblclick","tag-ondragover","tag-onkeydown","tag-overlay","tag-palette","tag-percentage","tag-photo","tag-photograph","tag-php","tag-pixel","tag-pixels","tag-platform","tag-polyline","tag-popup","tag-postcard","tag-processing","tag-programming","tag-proof-of-concept","tag-proportional","tag-px","tag-question","tag-quiz","tag-range","tag-redo","tag-resolution","tag-responsive-design","tag-revael","tag-reveal","tag-river","tag-river-world","tag-rivers","tag-row","tag-scroll","tag-share","tag-sharing","tag-size","tag-sms","tag-stop-press","tag-style","tag-stylesheet","tag-styling","tag-svg","tag-table","tag-table-cell","tag-television","tag-text","tag-top","tag-transparency","tag-tutorial","tag-underlay","tag-undo","tag-units","tag-url","tag-user-experience","tag-ux","tag-value-add","tag-warerfall","tag-width","tag-wikipedia","tag-world","tag-world-map"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/63485"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=63485"}],"version-history":[{"count":6,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/63485\/revisions"}],"predecessor-version":[{"id":63491,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/63485\/revisions\/63491"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=63485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=63485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=63485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}