PHP GD Image at Pixel Level User of Signature Tutorial
โœ‚๐Ÿƒ๐Ÿพโ€โ™€๏ธ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ
๐Ÿ“–

PHP GD Image at Pixel Level User of Signature Tutorial

PHP GD Image at Pixel Level User of Signature Tutorial

Weโ€™re getting there, but we are not there yet. Sound familiar?! Yes, to learn how to do something, it often requires the breaking up of the problem into bits. But no spoiler alerts today, as you continue on our journey โ€ฆ to who knows where?!

Yesterdayโ€™s PHP GD Image at Pixel Level Signature Web Storage Tutorial got us โ€œprojectingโ€ scribble data, our signatures, to a pixellated image data source.

That work yesterday involved HTML โ€ฆ

creatingโœ‚signatures via this downloadable HTML signature_signatureโšซhtml (with thesechanges and supervising thechanged Javascript signature_signatureโšซjs) we now show a pixellated view, like a negative, of the signature (with all the web browser sharing functionality) along with the dataURI image already created

โ€ฆ and for todayโ€™s purposes thechanges to the Javascript signature_signatureโšซjs represented the biggest changes to have canvas geometry being projected onto a pixellated image data source.

Where do we do this interfacing? Read down from Signature Signature Supervisor PDF Writing Tutorial through the blog posting to see us work up from that initial โ€œsignatureโ€ idea into a โ€œuser of signaturesโ€ supervisor with this liveโœ‚run showing a canvas that can โ€œprojectโ€ these new pixellated images now, using the HTML user_of_signature_signaturehtml (which changed in this way for those purposes).

So please hang on while we think about piecing some of these ideas into concepts to โ€œkick us down the roadโ€ towards our destination โ€ฆ no, weโ€™re not just going to celebrate โ€œbin nightโ€ โ€ฆ but youโ€™re getting warmer.

Stop Press

The โ€œchildโ€ PHP pixellateโšซphp (that changed in thisway and that you can try for yourself anโœ‚example positive live run) now accepts the (non-negative) or โ€ฆ



positive=Y

โ€ฆ argument to have a white background rather than the default black one, with the pixellated images created. Weโ€™d like to thank this very useful link.



Previous relevant PHP GD Image at Pixel Level Signature Web Storage Tutorial is shown below.

New PHP GD Image at Pixel Level Signature Web Storage Tutorial

PHP GD Image at Pixel Level Signature Web Storage Tutorial

With yesterdayโ€™s PHP GD Image at Pixel Level Signature Tutorial pixellating of a signature, behind the scenes there were HTTP Cookies used as a mechanism to store signature data. Today, we have a dual purpose, that being โ€ฆ

Just to reiterate on web storage, that was introduced with HTML5 โ€ฆ

With web storage, web applications can store data locally within the userโ€™s browser.

Before HTML5, application data had to be stored in cookies, included in every server request. Web storage is more secure, and large amounts of data can be stored locally, without affecting website performance.

Unlike cookies, the storage limit is far larger (at least 5MB) and information is never transferred to the server.

Web storage is per origin (per domain and protocol). All pages, from one origin, can store and access the same data.


Previous relevant PHP GD Image at Pixel Level Signature Tutorial is shown below.

PHP GD Image at Pixel Level Signature Tutorial

PHP GD Image at Pixel Level Signature Tutorial

Yesterdayโ€™s PHP GD Image at Pixel Level Geometry Tutorial set us up for more organizational uses of our pixel level image web application of late. We continue on with that idea, today, with the idea of a signature, and go right back to the Signature Signature Primer Tutorial scribble in a canvas functionality (as the source of our co-ordinates for a signature) and ready the PHP pixellateโšซphp (that changed in thisway) to accept โ€ฆ

  • map/area element HTML input data โ€ฆ like we deal with โ€œlegendโ€ functionality as mentioned in Legend for and from HTML Map Element Web Server Tutorial (and its ilk) โ€ฆ (all the way) down to (the pared down essence that is a) โ€ฆ
  • co-ordinate list of comma separated (x,y) values that is โ€œpen downโ€ as the default but +0,0, or ; can be indicators of โ€œpen upโ€

โ€ฆ the latter of which we take from the โ€œsignatureโ€ web application (via Google Chrome Developer Tools) over to the โ€œlegendsโ€ functionality legend_via_mapโšซhtm that changed in thissmall way (and that you can try for yourself with this liveโœ‚run link) to add another new button to link to the PHPโœ‚pixellate live run type functionality.

Maybe you can see where we are heading with all this, but we need to walk before running?! This link to โ€œscribbleโ€ canvas work is a step in itself, and if you are new to the idea of โ€œscribblingโ€ on canvas then youโ€™ll need to sidetrack with that Signature Signature Primer Tutorial link way above to get all this in context. Chow for now.


Previous relevant PHP GD Image at Pixel Level Geometry Tutorial is shown below.

PHP GD Image at Pixel Level Geometry Tutorial

PHP GD Image at Pixel Level Geometry Tutorial

Weโ€™re off jumping again (post yesterdayโ€™s PHP GD Image at Pixel Level Animation Tutorial โ€œchickenโ€ work) a.k.a. โ€ฆ

On a (web application) โ€œtoolโ€ project, is it the chicken or the egg that drives you? Sometimes, for us, we jump around. For us, depending on the nature of the โ€œtoolโ€ we enjoy trying to โ€ฆ

  • make the โ€œchildโ€ generic โ€ฆ the โ€œeggโ€ above
  • interface interestingly from the โ€œparentโ€ usefully โ€ฆ the โ€œchickenโ€ above

โ€ฆ because it occurs to us, with the โ€œeggโ€, so far weโ€™ve just been throwing โ€œgame likeโ€ โ€ฆ



$x = rand(0, $width);

$y = rand(0, $height);

โ€ฆ randomosity regarding co-ordinates used to pixellate โ€œpointโ€ data. But suppose, today, we open the door to some order, some mathematical geometry ideas?! Weโ€™ve come up with the following additional parameterization ideas (not interfering with anything else that has come before โ€ฆ ie. โ€œforward compatibilityโ€), namely โ€ฆ

  • coords โ€ฆ comma separated (x,y) co-ordinate set pairs that, by default, represent โ€œpen downโ€ rasterizations (our best โ€œthought bubbleโ€ word for pixellations not in โ€œpointโ€ form but in โ€œpen downโ€ โ€œplottingโ€ form โ€ฆ from the early โ€œscanningโ€ days of laser printers and even earlier days of data plotters โ€ฆ that โ€œrasterizeโ€ linear data into โ€œpixellatedโ€ form) โ€ฆ including a โ€œ+โ€ sign at the start of โ€œxโ€ or โ€œyโ€ values is your way of defining โ€œpen upโ€
  • closecoords โ€ฆ as above, but join last to first as well (or just mention to say this about the coords value)
  • circle โ€ฆ circle information comma separated (cx,cy,radius) sets
  • arc โ€ฆ relevant to circle in the form of clockwise arc in degrees to allow or the comma separated (start,end) of clockwise arc in degrees starting with the zero degrees (north) bearing as zero

โ€ฆ and youโ€™ve got the beginnings of some โ€œorderlyโ€ geometry, and some โ€œpen up/pen downโ€ thoughts (and we recommend insomniacs try chanting โ€œpen upโ€, โ€œpen downโ€ very sombrely for however long it takes rather than envisaging โ€œpigsโ€ โ€ฆ now thatโ€™s almost as ridiculous as baaaaa baaaaaaas), simple though it is, up to now.

Again, you can try this for yourself at this โ€œchildโ€ โ€œstandaloneโ€ liveโœ‚run link for the PHP pixellateโšซphp that changed in thisway for todayโ€™s extended geometry (and pen up/pen down logic) choices.


Previous relevant PHP GD Image at Pixel Level Animation Tutorial is shown below.

PHP GD Image at Pixel Level Animation Tutorial

PHP GD Image at Pixel Level Animation Tutorial

Yesterdayโ€™s PHP GD Image at Pixel Level Outputs Tutorial was a tilt back to getting the โ€œhard working duckโ€ PHP child process more user friendly, and donโ€™t know if the PHPโ€™s newfound โ€ฆ

โ€œparentโ€ โ€œbodyโ€ (or other) element background image

โ€ฆ clang any bells in your head regarding possibilities, but it did for us regarding how to start using that PHP โ€œchildโ€ iframe functionality in terms of an animation (effectively). Supposing we โ€œstartโ€ (and, no doubt โ€œstartโ€ is just that) with an HTML โ€œparentโ€ web application that just consists of โ€ฆ

  • table element with one row and three columns for now โ€ฆ and (a bank of) โ€ฆ
  • iframe elements

โ€ฆ respectively providing โ€ฆ

  • where to place animation โ€ฆ and โ€ฆ
  • means by which to create the animation

โ€ฆ because when you consider what โ€œanimationโ€ consists of, we now have the wherewithal to do it in that โ€ฆ

  • an โ€œanimationโ€ is a set of โ€ฆ
    1. moving
    2. images

    โ€ฆ where โ€ฆ

  • the โ€œmovingโ€ is worked by timed (via Javascript setTimeout method) creation of (table) cellular background
  • โ€œimagesโ€ pixellated by the โ€œchildโ€ iframe PHP โ€œtoolโ€ web application (unchanged from yesterdayโ€™s work)

โ€ฆ moved fast enough to help the human mind recognize it as โ€œanimationโ€, whose HTML supervisory โ€œparentโ€ code can be downloaded as build_night_skyโšซhtml and tried with this liveโœ‚run link.


Previous relevant PHP GD Image at Pixel Level Outputs Tutorial is shown below.

PHP GD Image at Pixel Level Outputs Tutorial

PHP GD Image at Pixel Level Outputs Tutorial

On a (web application) โ€œtoolโ€ project, is it the chicken or the egg that drives you? Sometimes, for us, we jump around. For us, depending on the nature of the โ€œtoolโ€ we enjoy trying to โ€ฆ

  • make the โ€œchildโ€ generic โ€ฆ the โ€œeggโ€ above
  • interface interestingly from the โ€œparentโ€ usefully โ€ฆ the โ€œchickenโ€ above

You could class yesterdayโ€™s PHP GD Image at Pixel Level Background Tutorial as a (baark, baark baark baark) โ€œchickenโ€ moment, enjoying writing a quirky โ€œparentโ€ for the โ€œImage Pixellatingโ€ โ€œchildโ€ iframe PHP code, even prompting an (important) improvement in its abilities โ€œopacityโ€ wise.

Today, though, you may think of it as stepping back to the โ€œPrimerโ€ tutorial, but to us is sometimes the way projects โ€œrollโ€, in that we think of a whole lot more functionality parts for the โ€œeggโ€ (โ€œchildโ€ iframe PHP image pixellator). These new functionalities can all be classed as โ€ฆ



forms of output

โ€ฆ changes, where we can envisage โ€œparentโ€ web applications that will demand far more flexibility than just offering the โ€œparentโ€ yesterdayโ€™s sole โ€œoutputโ€ (mode) option of โ€ฆ



image data in a "child" iframe created via PHP's



header('Content-Type: image/png');

imagepng($gd);

โ€ฆ line of thinking. With incredibly useful help from this useful link, thanks (which, incidentally, appeared up the top of the list of this Google search) we were reminded of how that PHP code lines above could be โ€œmeldedโ€ into โ€ฆ



// header('Content-Type: image/png');

ob_start();

imagepng($gd);

$image_data = ob_get_contents();

ob_end_clean();

$image_data_base64 = base64_encode($image_data);

โ€ฆ to end up with, in the PHP variable $image_data_base64 above a dataURI of the image pixellated by our (โ€œchildโ€ iframe supervised, perhaps) PHP web application, and opening the door to all manner of (additional โ€œoutputโ€ driven) interfacing (or standalone) possibilities like โ€ฆ

You can try this for yourself at this โ€œchildโ€ โ€œstandaloneโ€ liveโœ‚run link for the PHP pixellateโšซphp that changed in thisway for todayโ€™s extended โ€œoutputโ€ choices.


Previous relevant PHP GD Image at Pixel Level Background Tutorial is shown below.

PHP GD Image at Pixel Level Background Tutorial

PHP GD Image at Pixel Level Background Tutorial

Yesterdayโ€™s PHP GD Image at Pixel Level Primer Tutorial had us musing โ€ฆ.

Do you feel this web application has the genericity to be a โ€œtoolโ€? Spoiler alert โ€ฆ we think so.

โ€ฆ and so here we are, today, with the first idea regarding using that PHP code as a โ€œtoolโ€, a โ€œbackground image iframeโ€ tool, using two (of the usual โ€œthree amigosโ€, z-index having gone walkabout due to โ€œrelevance deprivation syndromeโ€, today) of our usual โ€œoverlayโ€ suspects โ€ฆ

We encase yesterdayโ€™s PHP work into an HTML iframe โ€œchildโ€ element, and rather than relying on the โ€œparentโ€ supervisory (and new) HTML pixellateโšซhtml to control opacity via the opacity of the HTML iframe element (which we may still allow for โ€ฆ weโ€™ll see) we opt to make the โ€œchildโ€ HTML iframe PHP be that little more flexible by allowing for pixellateโšซphp change in thisway to allow for a tailored calling mechanism regarding โ€œopacityโ€ via โ€ฆ

โ€ฆ that is user controllable via โ€œ&opacity=1.0โ€ type of URL bit where (1.0=opaque, 0.0=transparent) usage.

The parentโ€™s job using this PHP โ€œchildโ€ would be to set some transparency to an HTML โ€œiframeโ€ call of the PHP to cover the window, where we call into play the Javascript window.getComputedStyle method to resize the PHP โ€œchildโ€ to full window dimensions, on the proviso that any parameters the user uses to call the โ€œparentโ€ HTML donโ€™t override this โ€œdefaultโ€ width and height of background image (ie. PHP โ€œchildโ€ iframe) settings.

Guess the other job of the โ€œparentโ€ is to โ€œmeanโ€ something, and so we write some content on the โ€œthemeโ€ of โ€œLyrics of Songs about Starsโ€ because the background image effects you get with the โ€œpixellatedโ€ PHP GD calls remind us of the nighttime sky, and stars, and you can see this in action with todayโ€™s liveโœ‚run link.


Previous relevant PHP GD Image at Pixel Level Primer Tutorial is shown below.

PHP GD Image at Pixel Level Primer Tutorial

PHP GD Image at Pixel Level Primer Tutorial

A great place to start learning about the serverside language PHP is to read the webpage Image Processing and GD because PHP is great in so many ways regarding image creation and manipulation.

The GD methods (down to the pixel level, with the first one) we use are โ€ฆ

What we parameterize is โ€ฆ

  • width of image
  • height of image
  • density of pixels created
  • size of conglomeration of pixel (rectangular โ€œblobโ€)

Todayโ€™s PHP code you can download via this pixellateโšซphp link and try it via this liveโœ‚run link. We kind of like some of the images as below โ€ฆ

//www.rjmprogramming.com.au/PHP/pixellate.php?height=600&width=890&size=6&zeroes=4

//www.rjmprogramming.com.au/PHP/pixellate.php?height=600&width=890&size=8&zeroes=2

//www.rjmprogramming.com.au/PHP/pixellate.php?height=600&width=490

Do you feel this web application has the genericity to be a โ€œtoolโ€? Spoiler alert โ€ฆ we think so.

You can see this, also, at WordPress 4.1.1โ€™s PHP GD Image at Pixel Level Primer Tutorial.

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, Tutorials and tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

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