Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PROCESSWIRE PAGEIMAGE MODULE

.

Pia - Pageimage Assistant

Module for ProcessWire 2.5.0+ and 3.0+

Version 1.0.0

Hello, today I can tell you that Pia Ballerina want to assist you with Pageimages and that can become really helpful!

1) Pia provides:

.
a GUI (the module config screen) for quick and easy changes to the sitewide Pageimage default options
.
an alternative way for calling the Pageimage resizing methods with PW selector strings
.
three new methods as shortcuts to the resizing functions
########

2) Instead of ->width(), ->height(), ->size() you can call ->pia() now.

With a PW selector string you tell Pia what image variation you want to have:

$image->pia("width=100, quality=80, sharpening=medium")->url;

If you want process ->width() just define width.

$image->pia("width=480")->url;

If you want process ->height() only define height.

$image->pia("height=320")->url;

If you want process ->size() just define width and height.

$image->pia("width=400, height=300")->url;

If you want process ->size() with equal values for width and height, just define only size, or use the alias square:

$image->pia("size=350")->url; | $image->pia("square=350")->url;

So, yes, - I see. Now you may think: "Ok, nice looking girl, - and she can dance very well, - but for what should it be good that she is involved here? My very old buddies width, height and size - and me, - we don't need any Ballerinas between us!"
Yeah, I see what you mean. But this above is not what Pia is good for, this is just a little warming up for you.

In some cases one need to specify more than just width and / or height. If it comes to that you need explicitly populated options with the individual pageimages, Pia will become faster and more comfortable at some point. Also the code is looking more readable with Pia, at least to me:

// regular style #1:

$image->width(800, array("upscaling" => false, "cropping" => true, "quality" => 80, "sharpening" => "strong"));

// or regular style #2:

$options = array("upscaling" => false, "cropping" => true, "quality" => 80, "sharpening" => "strong");

$image->width(800, $options);

// now lets Pia dance:

$image->pia('width=800, upscaling=0, cropping=1, quality=80, sharpening=strong');

$image->pia('width=800, upscaling=off, cropping=on, quality=80, sharpening=strong');

For me it is that not only Pia begin to dance, my fingers do so too when writing selector strings instead of the regular array code.

Ok, last thing before we can go to stage: "You already may have noticed that Pia accepts few different values for boolean expression, yes?"

for TRUE you can write these strings: "1, on, ON, true, TRUE, -1"

for FALSE you may use one out of "0, off, OFF, false, FALSE"

Ready? Ok, lets go to stage.

. . .

3) Pia provide three new methods as shortcuts. This means that when using one of the shortcuts you have pre-populated options, regardless of the sitewide default settings:

crop :: does what the name says

contain :: is equal to the regular method: ->size($width, $height, array("cropping" => false))

cover :: this, Pias third child, is a new kid on the block

Let's have a closer look and compare it. We use Pias image from above as source for this example. (It's dimensions are 289 x 400 px)

crop

$image->crop('square=100');

it is 100 x 100 px and the name is: pia-ballerina_titel.100x100-piacrop.jpg

contain

$image->contain('square=100');

it is 73 x 100 px and the name is: pia-ballerina_titel.100x100-piacontain.jpg

cover

$image->cover('square=100');

it is 100 x 139 px and the name is: pia-ballerina_titel.100x139-piacover.jpg

Ok, you got it?

"Crop" crop out the area,

"Contain" fits the image into the area,

"Cover" calculates the needed dimensions for the image so that the area is completly covered by it.


.

You can get the module from the modules directory

or from the repo on Github

Bye!

Classical ballet performance at the Aalto Theatre in Essen, in the context of the Red Dot Award ceremony 26 June 2007,
Act III, Sleeping Beauty, the wedding reception
Photos: Horst Nogajski - www.nogajski.de

About

Module / Plugin for ProcessWire 2.5.0+

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors