Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using WpeMatico plugin which saves images in the post using:

$attach_id = wp_insert_attachment( $attachment, $filename, $postid );

I looked inside wp-includes/post.php > wp_insert_attachment function, but couldn't quite figure how to resize images. I want ALL/ANY images to have a max size of 1024 resize proportionately. I also have the resizing function, just not sure how to use it.

Thanks!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The original image size (i.e. 'full') is never modified. Intermediate image sizes are controlled in various places:

  1. Default image sizes ( 'thumbnail', 'medium', 'large' ): core settings, via Dashboard -> Settings -> Media
  2. Custom image sizes: Theme functions.php file, via add_image_size()
  3. Post Thumbnail size ( 'thumbnail' ): Theme functions.php file, viaset_post_thumbnail_size()`

By default, the 'large' image size is constrained to 1024px. So, you can simply output this image size where you need a 1024px image.

If you need to create a custom image size, you'll just need to regenerate thumbnails for existing images.

Edit

If you need/want to constrain the size of the 'full' image size, then you'll need to modify it during the upload process, i.e. by hooking into wp_handle_upload, and performing the resize.

There are various Plugins that accomplish this. A quick search turns up:

share|improve this answer
    
All the options you mentioned resize the image only for DISPLAY, they don't actually "resize" the image to those dimensions, right? I want to resize the image on upload to reduce file size. –  Nimbuz May 14 '12 at 16:53
    
See edited answer. –  Chip Bennett May 14 '12 at 17:15
    
Thanks, but again, those plugins won't help me because WpeMatico is uploading those images programmatically, I'm not uploading them manually myself so I could use those plugins. –  Nimbuz May 14 '12 at 17:21
    
Use a different Plugin, then? Or just use the core UI for image attachments? –  Chip Bennett May 14 '12 at 18:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.