How to resize images in wordpress - Coding Cyber

How to resize images in wordpress

To resize images in wordpress, it can be done in multiple ways one of the ways we can add_image_size function in the theme functions.php file. And the other way is we have to use the third party code to resize the images.

First method: adding code to functions.php file

[php] add_image_size(‘1024×600’, 1024, 600, true);
add_image_size(‘1024×768’, 1024, 768, true);

You can add as many sizes as you want, one of the disadvantages of using this is it will increase the disk space because it will generate the thumbnails while uploading the images.

Second method: Using third party code

One of the third party code that i use is timthumb, it will generate the images on the fly based on the original image. Just copy and paste the code in root of the wordpress installation.
[html] http://localhost/child-theme/resizer.php?src=/child-theme/wp-content/uploads/2013/02/ocean-clouds.jpg&h=600&w=1024
[/html] After the resizer.php, pass the image url and the height and width attributes you can change the height and width.

Vivek Vengala

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 2 comments

I don’t recommend using TimThumb, instead use Aqua Image Resizer or other script that use WordPress built in function.


    The problem with built in wordpress function, it will creates all thumbnail sizes, there is no way to generate images on the fly…


Leave a Reply: