# Helpers
This are our image helpers. You can use the method or call imagehelper
and then the method. By default, imagehelper
will be return a string if you printed on a view.
All the examples are using this source
https://images.weserv.nl/?url=ory.weserv.nl/zebra.jpg (opens new window)
Keep attention
First integer parameter will be always the width
.
# Cache
imagehelper($imageUrl);
# Thumb
Creates a thumb from given image
Keeping the aspect-ratio
thumb($imageUrl, 300, 300); // respect aspect-ratio
//or
imagehelper($imageUrl)->thumb(300, 300);
Without the aspect-ratio
thumb($imageUrl, 300, 300, true); // don't respect aspect-ratio
//or
imagehelper($imageUrl)->thumb(300, 300, true);
# Resize
Just resize the image maintaining the aspect-ratio.
Height parameter is optional.
resize($imageUrl, 350, 350);
resize($imageUrl, 350);
//or
imagehelper($imageUrl)->resize(350, 350);
imagehelper($imageUrl)->resize(350);
# Square
To create a square from given image
square($imageUrl, 300);
//or
imagehelper($imageUrl)->square(300);
Creating the square focusing in the main object
square($imageUrl, 300, true);
//or
imagehelper($imageUrl)->square(300, true);
# Crop
To create a square from given image.
Parameters: width, height, x and y.
crop($imageUrl, 400, 400, 1200, 550)
//or
imagehelper($imageUrl)->crop(400, 400, 1200, 550);
# Blur
To create a blurred image.
Important: Default value is 5
. Valid range from 1 to 100,
blur($imageUrl)
blur($imageUrl, 15)
//or
//
imagehelper($imageUrl)->blur();
imagehelper($imageUrl)->blur(15);