Opened 14 years ago
Closed 14 years ago
#22438 closed defect (bug) (fixed)
wp_generate_attachment_metadata() should not call WP_Image_Editor if there's nothing to resize
| Reported by: | mdawaffe | Owned by: | nacin |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Media | Version: | 3.5 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
wp_generate_attachment_metadata() calls WP_Image_Editor::multi_resize() to create the intermediate sizes of the image.
If there are no sizes to create, WP_Image_Editor::get_instance() should not be called. It will not be used for anything and is a waste of resources.
If it is called, and the image is very large, a needless Out of Memory Fatal Error can result.
Patch attached.
Attachments (1)
Change History (4)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I put in the else condition to set
$metadata['sizes'] = array()since that's what the current behavior in trunk is:::multi_resize()returns an empty array if$sizesis empty.In 3.4,
$metadata['sizes']would have been left unset.