Resizing images in WordPress is a common problem for theme developers & designers who want to be able to quickly resize multiple images. However, scripts used to resize images for WordPress we’ve been using so far always lack something important – some are slow, other will clutter your directories with images and some will even create security holes in your website. Thankfully, there is a very simple PHP script that will make image resizing in WordPress simple & easy without any negative side effects. The script we are talking about is Aqua Resizer – the simpler, better and lighter version of TimThumb that is found in many frameworks and themes. TimThumb is more popular, but there are a number of security vulnerabilities in its code that turn it into a potential threat for your website’s safety. You can see how to fix wordpress security here.
Why Use Aqua Resizer to Auto Resize Images in WordPress?
Although many designers and developers still use TimThumb, we think it is a matter of time for them to discover the intriguing new features and functions of Aqua Resizer. The simple PHP script is already integrated in some popular themes and I hope that by the end of 2014 it will become an essential part of any WordPress theme.
So many of you are probably wondering – “Why use this script when WordPress has integrated thumbnail support?” There are many reasons why I personally prefer Aqua Resizer over other scripts that serve the purpose of resizing images in WordPress. First of all, Aqua Resizer gives you the ability to set several sizes for thumbnails, so this way you can use different thumbnails in different areas of your website. Have you ever thought that using smaller images will make your posts easier for color printing? If you don’t have a Print button, then learn how to add Print Button in WP posts in simple way!
It’s incredibly easy to integrate with WordPress and some of the script’s other great advantages are:
- Very light – the script is just 8KB in size
- The thumbnails look excellent after resizing, so you won’t have to worry about loss of quality
- Excellent documentation and satisfying support
- It will resize all images in WordPress blog and will give them clean URLs
Despite its small size, Aqua Resizer is pretty flexible and you can set different parameters for width, height, quality and ratio of the images.
Resizing Images in WordPress with Aqua Resizer
Most image resizers aren’t easy to integrate with WordPress, but integration won’t be an issue when you use Aqua Resizer. It can be installed on just about any WordPress theme and thanks to our tutorial you’ll learn how to do it too.
Install Aqua Resizer on Your WordPress theme
The first step is to follow this link and download the file. Afterwards, upload the file named aq-resizer.php to the main directory of the WordPress theme you are using. Keep in mind that if you are using a child theme, then you need to upload it to the main directory of the child theme.
Now that the script is installed you just need to tell WordPress where to look for it. In order to do this you have to open the functions.php of your template and add the following code on a new line:
The installation is now complete and resizing images in WordPress via Aqua Resizer is nos possible. The next step is to edit the images themselves and to take full advantage of the script’s functionality. Did you also know that by editing WordPress’ files you can add custom buttons to the WordPress editor?
Add Thumbnails to Any Area of Your Website
The Aqua Resizer script can be used absolutely everywhere in WordPress, so it’d take us a lot of time to tell you all the ways you can use this script. For now, we’ll give you a simple example on how to generate custom thumbnails using the neat little script you just installed. Open the file in which you want to display the thumbnails and paste the following code into the desired place:
<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="<strong>150</strong>" height="100" alt="<?php the_title(); ?>"/>
As you can probably see, this piece of code will generate thumbnails that have a fixed width of 150 pixels and fixed height of 100 pixels. You can crop the images in wordpress in case they are too big to resize, so the next time you find yourself wondering how to resize images in WordPress, you can opt for Aqua Resizer, because this simple script is currently the best way to resize WordPress images in a quick and safe manner.