[wp-trac] [WordPress Trac] #27285: Thumbnails are not managed for SVG attachment files

WordPress Trac noreply at wordpress.org
Wed Mar 5 19:44:05 UTC 2014


#27285: Thumbnails are not managed for SVG attachment files
---------------------------+-----------------------------
 Reporter:  yannlossouarn  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Media          |    Version:  3.8.1
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 This is a turnaround, because PHP getimagesize() does not manage SVG
 (vector format...) and sets a 1x1 pixel size in that case. On the page,
 the wordpress thumbnail is therefore set to 1x1, almost invisible.

 Here's a patch : in /wp-includes/media.php, function
 wp_get_attachment_image(), line 550 :

 replace :

 {{{
 $hwstring = image_hwstring($width, $height);
 }}}

 with


 {{{
 if($image[1] == 1 && $image[2] == 1)
   $hwstring = '<img ';
 else
   $hwstring = image_hwstring($width, $height);
 }}}
 ... would allow a nice thumbnail to be displayed.

 Thanks !
 Yann Lossouarn

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


More information about the wp-trac mailing list