Support » Plugins » static dimensions for uploaded original images

  • using wp 2.1.3

    okay, i’ve found a lot of postings, hack-suggestions and pretty cool plugins, but i’m in needs to find out which piece of code is writing the original files (images) from the upload-dialog.

    i just want to resize (imagecopyresized ?) the uploaded images to fixed maximum dimensions. do i have to change some code in the wp_handle_upload function?

    many thanks for any suggestions

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    So, you want it to resize the original images? Or are you talking about changing the size of the thumbnail images that it creates from the resizing?

    Right now, it doesn’t do anything to the original images at all. You could probably hook the add_attachment action hook to get the post_id of the attachment, after it has been added. Then you could pull the image data from the post and do whatever resizing you like to the original image. You’d also need to update the width and height parameters in the attachment though.

    But no piece of code “writes” the original file. PHP handles that by itself. The wp_handle_uploads() function takes the upload and moves it to the right place. Then wp_insert_attachment() deals with all the rest of it for the database functions. If you really wanted, you could hook the wp_handle_upload filter to get the filename and type and such, and resize it there.

    Thanks Otto,

    yes, all it is about is to resize the original images. The wp_handle_uploads doesn’t seem to be the right file to be involved for this issue.

    I’ll have a closer look to the wp_insert_attachment(), and if there are stil some questions left, i will continue this thread. otherwis i’ll try to post my poor progressions here.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘static dimensions for uploaded original images’ is closed to new replies.