[wp-trac] [WordPress Trac] #22438: wp_generate_attachment_metadata() should not call WP_Image_Editor if there's nothing to resize

WordPress Trac noreply at wordpress.org
Wed Nov 14 11:11:35 UTC 2012


#22438: wp_generate_attachment_metadata() should not call WP_Image_Editor if
there's nothing to resize
-----------------------------+--------------------------
 Reporter:  mdawaffe         |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:  trunk            |   Severity:  normal
 Keywords:  has-patch        |
-----------------------------+--------------------------
 {{{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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22438>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list