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_signaturejs 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 liverun 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 pixellatephp (that changed in thisway and that you can try for yourself an
example positive live run) now accepts the (non-negative) or โฆ
|
โฆ 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.
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 โฆ
- signatures are a good candidate to start using web storage (localStorage โ stores data with no expiration date) rather than HTTP Cookies, as there is about 10mB to play around with using this method โฆ as well as โฆ
- when 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
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.
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 pixellatephp (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_maphtm 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.
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โ liverun 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.
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 โฆ
- moving
- 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_skyhtml and tried with this live
run link.
Previous relevant PHP GD Image at Pixel Level Outputs Tutorial is shown below.
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 โฆ
- โstandaloneโ โimageโ data presented in an HTML img element, as in โฆ
//www.rjmprogramming.com.au/PHP/pixellate.php?mode=image&height=600&width=590&size=8&zeroes=2
- โstandaloneโ โdivโ image data encased in an HTML div element, as in โฆ
//www.rjmprogramming.com.au/PHP/pixellate.php?mode=div&height=600&width=590&size=8&zeroes=2
- โstandaloneโ โcanvasโ image data placed into in an HTML canvas element, as in โฆ
//www.rjmprogramming.com.au/PHP/pixellate.php?mode=canvas&height=600&width=590&size=8&zeroes=2
- โstandaloneโ โbodyโ element background image
- โparentโ โimageโ data presented in an HTML img element, as in โฆ
- โparentโ โdivโ image data encased in an HTML div element, as in โฆ
- โparentโ โcanvasโ image data placed into in an HTML canvas element, as in โฆ
- โparentโ โbodyโ (or other) element background image
You can try this for yourself at this โchildโ โstandaloneโ liverun 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.
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 โฆ
- position:absolute property (teamed with top:0px and left:0px)
- opacity
We encase yesterdayโs PHP work into an HTML iframe โchildโ element, and rather than relying on the โparentโ supervisory (and new) HTML pixellatehtml 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 โฆ
imagecolorallocateimagecolorallocatealphaโs fifth โalphaโ (ie. 127=transparent, 0=opaque) parameter
โฆ 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 liverun link.
Previous relevant PHP GD Image at Pixel Level Primer Tutorial is shown below.
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 pixellatephp 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.