Skip to content
sy4mil edited this page May 7, 2012 · 13 revisions

Welcome to the Aqua-Resizer wiki!

If you have issues, questions and feedbacks, please use the Issues page of this git. :)

Usage

<?php aq_resize( $url, $width, $height, $crop, $single ) ?>

Parameters

$url (str)(required) - The image URL you want to resize/crop. Note: Must be uploaded through WordPress. Default: none

$width (integer)(required) - The width you want the image to be resized into. Default: none

$height (integer)(optional) - The height you want the image to be resized into. If this is not supplied, WordPress will an optimum height with dependency on the $crop settings. Default: null/false

$crop (boolean)(optional) - Choose whether to crop the image (TRUE), or only rescale the image to the required size (FALSE). Default: false

$single (boolean)(optional) - This will return an array containing url, width, and height if set to true. Otherwise, the function will just return a string containing the url of the cropped image. Default: false

Return

The function will return a string containing the URL of the cropped image by default, or return an array containing the cropped image url and it's new calculated width & height. The function will only run once for each image & set dimensions. Once the image is already cropped, it will only return the URL therefore you won't have to worry about the function hogging your server on each page load.

Examples

I have included several usage samples here. I will be including more soon.

Future plans

  • Ability to choose "quality" of the resized images (jpeg only)
  • Define custom cache path (currently uses default WP upload directory)
  • Custom suffix
Clone this wiki locally