WordPress / performance

Performance plugin from the WordPress Performance Group, which is a collection of standalone performance modules.
https://wordpress.org/plugins/performance-lab/
GNU General Public License v2.0
365 stars 99 forks source link

WebP image are not rotated when uploading. #146

Closed mitogh closed 2 years ago

mitogh commented 2 years ago

Bug Description

This might be an issue not necessarily to this repository due to the problem happening directly in core.

When a WebP image is uploaded with the rotated exif this exif is ignored and the image is uploaded as it is instead of rotating the image, as happens when a JPEG image is uploaded.

Steps to reproduce

  1. Upload the attached WebP image in this ticket
  2. After the upload is completed observe the image is not rotated.

Replicate the steps with the JPEG version to compare, when a JPEG is uploaded a rotated version is created and uploaded in the right orientation.

Screenshots

JPEG version

2022-02-02_16-55_1

WebP version

2022-02-02_16-55

Additional Context

Original JPEG image: https://www.flickr.com/photos/brevity/6221434141/in/photostream/

Due the limitation with GH WebP version can't be uploaded here but using the original image and Imagemagick you can create a WebP version using the convert command to replicate the problem.

Media handling info

Active editor WP_Image_Editor_Imagick
ImageMagick version number 1691
ImageMagick version string ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Imagick version 3.7.0
File uploads Enabled
Max size of post data allowed 100M
Max size of an uploaded file 100M
Max effective file size 100 MB
Max number of files allowed 20
Imagick Resource Limits area: 122 MBdisk: 1073741824file: 786432map: 512 MBmemory: 256 MBthread: 1
ImageMagick supported file formats 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
GD version bundled (2.1.0 compatible)
GD supported file formats GIF, JPEG, PNG, WebP, BMP
Ghostscript version 9.53.3
adamsilverstein commented 2 years ago

Hey @mitogh thanks for opening this. I do agree this might be a bug in the current core implementation. I don't think this is really a performance plugin issue (although I see how it is performance related since it is WebP related)... would you be willing to recreate this ticket on the WordPress core bug tracker (https://core.trac.wordpress.org/) instead?

Before that though, can you verify that the server you are testing this on supports WebP? You can check under Site Health -> Information -> Media Handling. Without that support, WebP uploads might work, but not much else (for example sub size image creation).

mitogh commented 2 years ago

WebP is supported on my installation due WebP image sizes are being created normally when using this plugin. I've updated the ticket with some more detailed information about this.

Looks like the problem on this one is due to the rotate function only support jpeg:

I'm opening a core ticket as a follow-up from this ticket, let me know if you think is better to close this one instead as the actual fix needs to happen in core. @adamsilverstein

mitogh commented 2 years ago

Adding the Core ticket as a reference:

adamsilverstein commented 2 years ago

Thank you @mitogh - closing this issue in favor of the core ticket.