Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#27285 closed defect (bug) (duplicate)

Thumbnails are not managed for SVG attachment files

Reported by: yannlossouarn Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8.1
Component: Media Keywords:
Focuses: Cc:


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);


if($image[1] == 1 && $image[2] == 1)
  $hwstring = '<img ';
  $hwstring = image_hwstring($width, $height);

... would allow a nice thumbnail to be displayed.

Thanks !
Yann Lossouarn

Change History (1)

#1 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #26256.

Note: See TracTickets for help on using tickets.