Pia - Pageimage Assistant

Provide alternative methods for Pageimages (crop, contain, cover, pia) to assist with $options array. Also provide GUI screen for easy and quick changes of sitewide Pageimage default-settings.

PROCESSWIRE PAGEIMAGE MODULE
Supportforum: https://processwire.com/talk/topic/8367-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

https://processwire.com/modules/pageimage-assistant/

or from the repo on Github

https://github.com/horst-n/PageimageAssistant

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

More modules by Horst Nogajski

  • WireMail: SMTP

    extends WireMail, uses SMTP protocol (plain | ssl | tls), provides: to, cc, bcc, attachments, priority, disposition notification, bulksending, ...
  • PageImage Manipulator

    This module provide basic Imagemanipulations for PageImages or Imagefiles ! FOR PW > 2.5.11+ and PW 3+, ONLY USE PageImageManipulator 2 !
  • Pagetree Add New Childs Reverse

    New Pages in Descending Sortorder (newest first) while sortmode is Manual Drag-n-Drop
  • Local Audio Files MP3-DB

    The Local Audio Files DB is a combination of a Module and a SiteProfile. It is intended to import MP3-files from your filesystem into ProcessWire, read ID3-Tags and pull coverImages from it to feed…
  • Pia - Pageimage Assistant

    Provide alternative methods for Pageimages (crop, contain, cover, pia) to assist with $options array. Also provide GUI screen for easy and quick changes of sitewide Pageimage default-settings.
  • Croppable Image 3

    Field that stores one or more GIF, JPG, or PNG images and support optional predefined crop functionality!
  • Image Animated GIF

    This module helps with resizing and cropping of animated GIFs when using GD-Lib.

All modules by Horst Nogajski

Install and use modules at your own risk. Always have a site and database backup before installing new modules.