Skip to content
TotPeRo edited this page Apr 21, 2014 · 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, $upscale ) ?>

Parameters

$url

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

$width

(integer)(optional) - The width to be resized into in pixels. If $width is not specified, $height is required. Default: null

$height

(integer)(optional) - The height to be resized into in pixels. If $height is not specified, $width is required. Default: null

$crop

(boolean)(optional) - Crop the image or not. False - Soft proportional crop mode ; True - Hard crop mode.. Default: null

$single

(boolean)(optional) False - Return an array containing url, width, and height. True - return url. Default: true

$upscale

(boolean)(optional) - Resizes the image when size is smaller than the crop size. Default: false

Return

Return image URL if single is set to true or not set. Otherwise return array() containing

  • [0] => url
  • [1] => width
  • [2] => height

In crop mode, the script returns false, if the image could not be resized to exactly the dimension specified (if $width and $height are given). You can specify only one site length if You are not interested in the others length result.

If the image given has to be resized to the exact size it already has the script returns the original image.

Examples

I have included several usage samples on this page. More will be included 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