[wp-trac] [WordPress Trac] #31228: The "+" character in add_image_size breaks wp_get_attachment_image

WordPress Trac noreply at wordpress.org
Wed Feb 4 02:42:54 UTC 2015


#31228: The "+" character in add_image_size breaks wp_get_attachment_image
--------------------------+-----------------------------
 Reporter:  ashorlivs     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  4.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If one adds an image size which name contains the "+" character,
 wp_get_attachment_image will return de base image instead of the resized
 image.

 {{{
 var_dump( wp_get_attachment_image( $attachment_id, 'full');
 // ... /elaenia.jpg (1200 × 797)

 add_image_size( 'test + image', 121, 135, true );
 var_dump( wp_get_attachment_image( $attachment_id, 'test + image');
 // ... /elaenia.jpg (1200 × 797)

 add_image_size( 'test - image', 121, 135, true );
 var_dump( wp_get_attachment_image( $attachment_id, 'test - image');
 // ... /elaenia-121x135.jpg (121 x 135)
 }}}

 Tested with Apache 2.4 in WP 4.1.

 Simply changing "+" with another character solves the issue.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31228>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list