Opened 14 years ago
Closed 7 months ago
#14106 closed enhancement (wontfix)
Post-processing of post thumbnails
Reported by: | nkuttler | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Post Thumbnails | Keywords: | |
Focuses: | performance | Cc: |
Description
I'm not sure if I'm missing something, but it looks like there is no hook to post-process post thumbnails. I want to add rounded corners to all thumbnails for a theme.
It looks to me like an action at the end of image_make_intermediate_size() in media.php with $file as parameter might do the trick. I'm not sure if that's the right place or when that function is called precisely though. So it might be necessary to add additional parameters to the function call to identify where the call came from.
Attachments (2)
Change History (17)
#2
@
14 years ago
- Keywords close added; post process removed
Yeah, I'd just round them through CSS.
You could also utilize the image_make_intermediate_size filter as a regular action hook if necessary, just make sure you return what you receive.
Works for me?
#3
@
14 years ago
- Cc office@… added
Does image_make_intermediate_size only run once per post thumbnail? I wasn't sure if that's the case. It would also be nice if the filter had some info which thumbnail size is being created, although I guess I could identify the image in the filter. But even then it would not be trivial to have post thumbnails of the same size with different effects.
As for round corners that's just an example. Add graphical borders, apply contrast filters, make black & white, sepia filter, etc.
#4
@
14 years ago
- Keywords reporter-feedback added; close removed
If the filter doesn't quite work for you, we can add context etc.
#5
@
14 years ago
I just had a look at the code again and it looks to me like implementing something like add_image_size( 'frontpage-black-and-white' ) is impossible if a differently named image_size is defined with the same dimensions.
Adding context to the filter would work, but image_make_intermediate_size() currently only receives $file, $width, $height and $crop, not the image_size by name. This could be modified easily I think.
Or maybe additional apply_filters( 'image_make_intermediate_size_$image_size_name', $filter )?
I could work on a patch if this is sounds acceptable.
#6
@
14 years ago
I meant
$resized_file = apply_filters('image_make_intermediate_size_$image_size_name', $resized_file);
@
14 years ago
First draft, make post-processing and renaming of thumbnails possible depending on named image_size
@
14 years ago
Small demo how the new filters can be used to post-process post thumbnails from a plugin/theme
#7
@
14 years ago
- Keywords dev-feedback added; reporter-feedback removed
Messing with the resized image name wasn't really useful, it's better to hook directly into image_resize().
#9
@
14 years ago
By the way, my patch would also make it possible to move the default downgrading of thumbnail image quality to a filter that users can remove. Not sure why the quality is reduced to 90.
#10
@
14 years ago
re image quality: http://wordpress.org/extend/plugins/imagemagick-engine/
You know you can make rounded corners on images using CSS, right?