Opened 11 years ago
Closed 11 years ago
#34124 closed enhancement (fixed)
image_get_intermediate_size not filterable
| Reported by: | A5hleyRich | Owned by: | DrewAPicture |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | Media | Version: | 4.3.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
11 years ago
- Milestone Awaiting Review → 4.4
- Owner set to
- Status new → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)

Add filter to rest of return cases; expand docs.