How to Resize Images in WordPress using Aqua Resizer

Share This Article:

Aqua Resizer is a PHP script that helps to easily resize images in WordPress without any hassle. Aqua Resizer can be considered as alternative to TimThumb, a popular 3rd part script that helps to resize images in a fly. Many themes and frameworks integrated with TimThumb are badly affected due to some malicious code injection vulnerability. So its not always good to rely on  scripts with security loop holes.

resize-images-wordpress-using-aqua-resizer

Reasons to Use Aqua Resizer

After facing some issues with TimThumb, I completely removed it and integrated Aqua Resizer into my Theme. Now, I’m pretty happy with this new resizer and its working like a charm. One major issue I faced with TimThumb is the ugly URL structure which never helps to Leverage Browser Caching.

You can ask me, why to use a 3rd party image resizer when you got WordPress thumbnail support ? Well, my answer to this question is I personally dont like those 150×150 thumbnails and would like to have some different size thumbnails on my blog homepage. You can see that I’m using two different sizes of thumbnails for Teasers and popular posts.

  • Free to use and easy to integrate with WordPress.
  • Light-weight script with less than 2KB size.
  • No Loss of quality and thumbnails will be generated in a fly.
  • Good support from the author and everything is well documented.
  • Clean URL’s with file extension at the end.

Apart from these, Aqua Resizer works with “Featured Images” and got many other options to control height, width, ratio and quality. Now, lets move on to the how-to part and also know how to Optimize WordPress for Google Page Speed.

Resize Images in WordPress using Aqua Resizer

Unlike other image resizers Aqua Resizer can be easily installed on any sort of WordPress Theme and can be used without any hassle. All these things are based on my experience and you can consider this as an unbiased review of Aqua Resizer Script.

Step 1: Installing Aqua-Resizer in your WordPress Theme

Download Aqua-Resizer from GitHub and upload aq-resizer.php file to your theme directory. In case if you are using a child theme, upload it to child-theme directory.

Now, you have to call this file by including require_once('aq_resizer.php'); code in functions.php file. If you are using thesis theme then add this code in custom_functions.php file.

You are done with the installation part and now its time to implement it for generating resized images in a fly. This is how thumbnail looks when its resized using Aqua Resizer:

resize images in wordpress using aqua resizer

Step 2: Add Thumbnails to Excerpts in Homepage

This code helps to display thumbnails in post excerpts of your WordPress blog. It supports featured images and you can see the parameters that are included in this code.

<div id="thumbnails">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url( $thumb,'full' ); $image = aq_resize( $img_url, 150, 100, true ); ?>
<img src="<?php echo $image ?>" width="150" height="100" alt="<?php the_title(); ?>"/>
</a>
</div>

You can change the width and height of thumbnails by tweaking the highlighted values in this code. Also, using of height and crop parameters in the code is upto you.

Using Aqua Resizer in Thesis

You can also use this code to display thumbnails in homepage teasers of Thesis Theme. Just wrap this code in functions and hooks as shown below.

function featured_thumbnails() {
if (!is_single() && !is_page()) { ?>

/** ADD ABOVE CODE HERE */
<?php }
}
add_action('thesis_hook_before_teaser', 'featured_thumbnails');

Now, add this entire code to custom_functions.php file and thumbnails will be live on your home page. Dont forget to follow Step 1, otherwise thumbnails will not be generated.

For further examples you can check Aqua Resizer Wiki.

If you need any sort of help in integrating Aqua Resizer in WordPress, drop a comment here and I will get back to you very soon. If you are already using Aqua Resizer, Share your views on it here.

Genesis is the most flexible WordPress theme framework that comes with tons of options. We have been using Genesis on all of our blogs and recommending the same to you. Every bit of it is coded according to the standards. Give it a try!

Comments

  1. PrIyAnGsHu says:

    I use TimThumb to resize images on most of my WordPress blogs but this new script looks to be also amazing. Let me try this out now. Anyways, thanks for letting us know about it Bharat.

  2. Kulwant Nagi says:

    I am using genesis, so please tell me how to do in genesis.

    • WPSquare says:

      Genesis uses default WordPress Thumbnails and there is no need to use a 3rd party image resizer. If you still want to give a try, use the code posted for Thesis and change the action hook to ‘genesis_before_post’. Hope this will help you.

  3. Rahul Kashyap says:

    really nice tutorial thanks for sharing this :)

  4. Christian says:

    Hi

    I use thesis and want exactly you say :

    - thumbnails on sidebars
    - thumbnails to excerpts in homepage

    I have several sites all thesis based but I tried on this site cristianneacsu.com , my poetry site and I have no idea why thumbs does’t appear.

    If you can help I will send you triple thank you.

    Anyway thank you for this post and all I find on your blog.

    Christian.

  5. Gautam Doddamani says:

    hi bharath can u tell me how to use this in genesis…i am using it in popular posts widget but its not working. where should we paste the two php get post thumbnail lines??

  6. GoWebBaby says:

    I am currently using aqua resizer and its having some very good features like:-
    Some of the features:

    Completely native – uses WP’s built-in functions
    Works both on single or multisite install
    Easy to use, just feed in the URL
    Lightweight – can be minified down to +/- 50 lines of code
    Only process image once, then return the URL if the image already resized
    Options to crop, soft-crop, array return etc.

  7. jampafoo says:

    How do you Zoom Crop? I need to zoom and scale up if the image is smaller than the area I am trying to fill. Tim Thumb had the option to zoom then crop….. This is the whole reason I dont use the built in functionality of wordpress’ post thumbnail alone.
    I am trying to use this and its not doing it!

  8. BFIntal says:

    I’d like to introduce to you also my own script BFI Thumb https://github.com/bfintal/bfi_thumb it has the same capabilities and benefits as Aqua Resizer plus it can perform some Timthumb filters (grayscale, negate, tint/colorize), it can also scale up images while still using native WP classes.

    @jumpafoo BFI Thumb defaults to cropping the image and allows upscaling of images (similar to timthumb)

  9. Dexter says:

    How can i align/position the cropping? timthumb has the option for this kind of issue.

Speak Your MindComments Policy →

*

Looking for More Awesomeness?

Read previous post:
pros-cons-wordpress-theme-frameworks
Pros and Cons of Using WordPress Theme Frameworks

Lets discuss some pros and cons on Using WordPress Theme Frameworks. If you dont know much about Frameworks, I recommend...

Close