Menu Close

Resize WordPress Images On The Fly With Aqua Resizer


Aqua Resizer is a small little script to dynamically resize, crop and scale images uploaded through WordPress on the fly. It is native, meaning it uses WordPress built-in functions to automatically process the images.

If you’re a theme author, you know how troubling it is to resize images on WordPress. There are a few methods & scripts out there that provides this functionality. Timthumb for example, is one of the most popular scripts that is used by theme authors but have some drawbacks that forces authors to look for alternatives. There are also the “native” way of doing it using the add_image_size() function which leaves tonnes of unused images on the server. Additionally, Victor Teixeira came up with the vt_resize script that was then quickly adopted by WooThemes – unfortunately, its usability is quite limited and in some cases too complicated to use.

Aqua Resizer, while not claiming to be better than the above methods, provides easy, fast, secure, and in general efficient way to solve all your needs in handling image resizing in your WordPress themes.

Aqua Resizer Features:

– Completely native, using WordPress built-in functions
– Works both on multisite and single WordPress install
– Just feed in URL, instead of using attachment id and all those stuff
– Optional cropping
– Can crop an already cropped image
– Lightweight – can be minified down to only <>50 lines of codes!
– Cache images (duh)
– Completely open source

Sample usage:

$thumb   = get_post_thumbnail_id();
$img_url = wp_get_attachment_url( $thumb,'full'); // Get img URL
$image   = aq_resize( $img_url, 560, 310, true ); // Resize & crop img ?>

<?php if ( $image ) : ?>

    <img src="<?php echo esc_url( $image ); ?>" alt="Your Image alt" />

<?php endif; ?>

More usage instructions and examples can be found on Aqua Resizer’s Github Page.

Aqua Resizer was written by Syamil MJ, a WordPress theme developer from Kuala Lumpur, Malaysia. He also developed the Slightly Modded Options Framework which can be found on Github. Find out more about him on Aqua Graphite’s website.

View Script On Github

View Source
Posted in WordPress