Image_resize and add_filter (4 posts)

  1. manuelmasia
    Posted 6 years ago #

    I'm trying to change in functions.php how to work image_resize function. I found this post (http://jstnryan.com/custom-image-suffixes-in-wordpress/) where the author modifies manually image_resize function to change how image_resize renames attachments.
    Is it possible to do the same think using add_filter?

    Thanks a lot...

  2. jstnryan
    Posted 6 years ago #

    To my knowledge, there are STILL no appropriate hooks into the image_resize( ... ) function, as of WP 3.0, so you'll have to continue to apply my hack manually.

  3. Daiv Mowbray
    Posted 6 years ago #

    Your hack seams to work as expected, but it fails to take into account added image sizes, either via your theme or plugins which may add extra image sizes. As of 3.0 there is a function to get an array of all available image sizes: get_intermediate_image_sizes(). Returns a filtered array of image size strings.
    I have a site set up which creates 8 different image sizes plus the original upload.
    I do wonder why you would need a different suffix.
    Perhaps you should have a look at the superslider-image plugin (add image to post via shortcode), or the superslider-media-pop plugin (adds numerous image control functions to the admin screens).

  4. jstnryan
    Posted 6 years ago #

    When I originally wrote the hack (as seen in the link above) it was intended only as an example of how someone could accomplish this functionality, not a best-case solution.

Topic Closed

This topic has been closed to new replies.

About this Topic