[wp-trac] [WordPress Trac] #55057: WebP images are not rotated in the same way JPEG images are rotated.

WordPress Trac noreply at wordpress.org
Fri Feb 11 15:42:04 UTC 2022

#55057: WebP images are not rotated in the same way JPEG images are rotated.
 Reporter:  mitogh        |       Owner:  adamsilverstein
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  6.0
Component:  Media         |     Version:  5.8
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  performance

Comment (by adamsilverstein):

 @mitogh Looking into this, so far I have discovered that PHP's
 `exif_read_data( $this->file );` returns false for your image, although I
 verified the Exif data is in the file with several web based scanners.
 I've tried with both libgd and imagick and both return `null`.

 I also tried using Imagick's `getImageProperties` function on the WebP and
 it only returned image dimensions.

 I've been researching a bit and as far as I can tell `exif_read_data` in
 PHP https://www.php.net/manual/en/function.exif-read-data.php does not
 support extracting WebP EXIF data, even though the format supports it.

 In order to fix this, WordPress would need to bundle our own exif parser
 (similar to the way we already parse image sizes) or bundle a 3p library
 to add the parsing.

 Since exif data is usually embedded in jpegs by cameras (that is where the
 Orientation is important), we probably don't need to worry about this too
 much - users will upload a jpeg which we can read exif data from, and
 WordPress will generate the WebPs. In the future if cameras start saving
 WebP images, this functionality would become more important.

Ticket URL: <https://core.trac.wordpress.org/ticket/55057#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list