• I’m trying to create a button or option on the upload screen that only doesn’t resize the image, so that I can pick and choose if I want different sizes for an image. I know the code below will unset the sizes all the time if put in functions.php . Is there a way to only implement it when a checkbox or some similar option is clicked?

    function custom_filter_image_sizes($sizes) {
    
    unset( $sizes['thumbnail']);
    unset( $sizes['medium']);
    unset( $sizes['large']);
    
    return $sizes;
    }
    add_filter('intermediate_image_sizes_advanced', 'custom_filter_image_sizes');

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi!

    I noticed that the WordPress Upload New Media (WordPress’s built-in multi-file uploader) by default will upload the original image (not resized) along with the thumbnail, medium and large copies of the image.

    Can you just leverage the original image for your purpose?

    Thread Starter Ryan_Prejean

    (@ryan_prejean)

    Well, my site uses a ton of images and I don’t need the large and medium versions for most of them. In order to save space, I would like to stop WordPress from saving those files in the first place. However, sometimes I do need the alternate sizes, so I don’t want to globally disable it.

    Have you checked out this plugin Resize Image After Upload?

    What do you think of it for this purpose?

    In its settings it has an “Re-size images: ” Yes/No dropdown box which could be toggled before/after an upload.

    How close is that to the “checkbox” functionality that you were envisioning?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Image Size Function’ is closed to new replies.