Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Resize Original Images WordPress

  • SOLVED

Hi,
Wordpress not resizing original images. I want a simple code that resize original images at upload. Dont need to have options page or something.

Max Width: 1024
Max Height: 800

You can check some plugins doing similar this:
http://wordpress.org/extend/plugins/resize-at-upload/
http://wordpress.org/extend/plugins/resize-on-upload/

I want a simplified code without options page and using wordpress's own image resizing system.

Answers (7)

2010-09-22

Victor Teixeira answers:

Hi, just use the 'auto image resizer plugin'. It will automatically resize all your uploaded images to the 'large' image size set in the media preferences and will delete the original image thus this will became the full image and will save a lot of space on your host.

But if you don't want to set the images to the 'large' image size and you still want your users to be able to configure the sizes on the media settings you can edit the plugin on line 36 as shown bellow:

//$width = get_option('large_size_w'); // instead of this
//$height = get_option('large_size_h'); // use this:
$width = 1024;
$height = 800;

That's it.

2010-09-12

Adam W. Warner answers:

Why not go to Settings-->Media and set the size you want for one of the default sizes? Read here for further explanation:
[[LINK href="http://adamwwarner.com/tutorials/a-little-known-setting-for-images-in-wordpress-that-will-make-posting-images-easier"]]http://adamwwarner.com/tutorials/a-little-known-setting-for-images-in-wordpress-that-will-make-posting-images-easier[[/LINK]]

Or did I not understand your question correctly?

2010-09-12

Denzel Chia answers:

Hi,

You can use Tim thumb. http://www.binarymoon.co.uk/2010/08/timthumb/

here is the script http://timthumb.googlecode.com/svn/trunk/timthumb.php

After you have uploaded the script, use the following html to auto resize the image.

HTML example:


<img src="http://example.com/scripts/timthumb.php?src=/images/whatever.jpg&w=150&h=200&zc=1" alt="" />


This script was originally written by Darren Hoyt, one of the owner of WP Questions.

Thanks.

2010-09-12

flashingcursor answers:

If you're using WP 3.0 there are a couple of ways you can accomplish what you'd like to do.

First of all, you can set your default image sizes in Settings->Media

If you need more image size options, you can create as many as you'd like by adding a few lines to your themes functions.php file.

add_image_size('Slideshow', 500, 260, TRUE);
add_image_size('Mini', 90, 90, TRUE);


These can be adjusted to your needs and then called from within your theme using the following code:

the_post_thumbnail('Slideshow'); // will display the 500x260 image
the_post_thumbnail('Mini'); // will display the 90x90 image


Finally, if you already have a lot of posts with images, once you've added the code above, you can use the Regenerate Thumbnails plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/

2010-09-12

Jeremy Jared answers:

I would recommend installing the nextGen Gallery plug-in. It is in my opinion the only way to handle images using Wordpress. You can set it to resize images at upload, set thumbnail sizes, organize images by gallery or insert single images inside of the text editor. NextGen gallery also has several add-ons which can be found at the plug-in download page.
Here is the link: http://wordpress.org/extend/plugins/nextgen-gallery/

2010-09-12

Duncan O'Neill answers:

First, you need to make sure that post thumbnail support is enabled for your theme;

In the functions.php file;
=============================

add_theme_support( 'post-thumbnails' );

//Then set your sizes

set_post_thumbnail_size(150,100,true); // or whatever size for small default images
add_image_size('large-thumb',1024,800,true);

==============================

Then to call it within the loop;

if (has_post_thumbnail){
the_post_thumbnail('large-thumb');
}

===============================

Use the featured image utility in your posts to upload new images.

Reference : Justin Tadlock's Everything YOu need to know about WP 2.9's post image feature;

http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature

2010-09-13

David answers:

I would go with the previous answers by Duncan O'Neill on setting your image sizes

and then If I understand your question correctly this plugin will help to resize all existing images to the sizes that you setup

<a href="http://wordpress.org/extend/plugins/regenerate-thumbnails/">regenerate-thumbnails</a>


Ünsal Korkmaz comments:

i dont understand why ppl not reading question.
I dont want other image size that creating. I want to resize original image to Max Width: 1024, Max Height: 800 I gave you sample addons that doing it, i just want simplified code that i can use in mu-plugins without options.


David comments:

This is the first time you reveal that you would like to use this in a mu environment.
Also what you are asking is not really possible in a simplified code...


This may work....
set your image sizes under media settings as per normal and then use the plugin that I suggested this will resize all of the existing photos to the correct sizes that you have set under media.

Depending on how may sites you have setup, this may place quite a strain on the server...