Toolkit for image manipulation.
To get a Toolkit_Image, use method getToolkitImage on classes supporting it.
Add multiple transformations to the image.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Add a crop transformation to the image.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Resizes the image. If the width or height is null, it will resize retaining the original aspect ratio.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Resizes the image only if too big
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Resizes the image. If the width or height is null, it will resize retaining the original aspect ratio.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Rotates the image
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Creates a vertical / horizontal or both mirror image.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Adds a watermark to the image.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Adds a border to the image.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Masks the image using the alpha channel of the image input.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Adds rounded corners to the image.
Parameters: |
|
---|---|
Returns: | The current Toolkit_Image for chaining. |
Turns the image into a grayscale version
Returns: | The current Toolkit_Image for chaining. |
---|
Build and return the URL of the modify image
Parameters: |
|
---|---|
Returns: | The URL of the modify image. |
Returns: | The dimensions of the modify image (an object containing width and height variables). |
---|
Creates an html image tag of the modify image
Sets width, height, alt attributes if not supplied.
Parameters: |
|
---|---|
Returns: | The image tag |
Apply transformations of the Image_URL instance on a file and save it
Returns: | The save file path |
---|
Parse an existing modify URL and set transformations in queue. Check if the hash part of the URL match.
Parameters: |
|
---|---|
Returns: | True or false if the hash part of the URL not match. |
<?php
$all_media_png = \Nos\Media\Model_Media::find('all', array(
'where' => array(
array('media_ext', 'png'),
),
)); // Get all images PNG in media
// Display all PNG, shrinked in 200x100, grayscale and rounded with a 5px radius, in a <img class="css_class" /> tag.
foreach ($all_media_png as $media) {
echo $media->getToolkitImage()->shrink(200, 100)->grayscale()->rounded(5)->html(array(
'class' => 'css_class',
));
}