Opened 9 years ago
Closed 9 years ago
#34124 closed enhancement (fixed)
image_get_intermediate_size not filterable
Reported by: | A5hleyRich | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 4.3.1 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
The large majority of functions within wp-includes/media.php
are filterable, which allows plugins to modify the return URLs and file paths for attachments.
The problem with image_get_intermediate_size
is that if all other methods of determining the correct image size fails, it falls back to the following:
// include the full filesystem path of the intermediate file if ( empty($data['path']) && !empty($data['file']) ) { $file_url = wp_get_attachment_url($post_id); $data['path'] = path_join( dirname($imagedata['file']), $data['file'] ); $data['url'] = path_join( dirname($file_url), $data['file'] ); } return $data;
The $data['url']
value is directly used in wp_image_editor
to output a preview of the existing image before making any edits:
The reason the image has returned 404 in this cause is because it's being served from S3 and contains illegal characters that need encoding.
Attachments (4)
Change History (10)
#2
@
9 years ago
- Milestone changed from Awaiting Review to 4.4
- Owner set to DH-Shredder
- Status changed from new to accepted
Hi @A5hleyRich! Thanks for this ticket and patch. I like it.
Attached 34124.3.diff, which expands the filter to handle all return cases, including those where $size
was passed a width and height.
Also expanded the docs for image_get_intermediate_size()
, since its signature is extremely confusing.
This ticket was mentioned in Slack in #core by mike. View the logs.
9 years ago
#4
@
9 years ago
- Owner changed from DH-Shredder to DrewAPicture
- Status changed from accepted to assigned
34124.diff is a refresh
Add filter to rest of return cases; expand docs.