[wp-trac] [WordPress Trac] #14459: Rotate Full Size Images on Upload
WordPress Trac
noreply at wordpress.org
Thu Aug 15 01:56:12 UTC 2019
#14459: Rotate Full Size Images on Upload
-------------------------------------------------+-------------------------
Reporter: mrroundhill | Owner:
| mikeschroder
Type: enhancement | Status: reviewing
Priority: normal | Milestone: Future
| Release
Component: Media | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by azaozz):
Replying to [comment:71 pbiron]:
Thanks for the patches and the detailed explanation! :)
Let me try to answer the questions:
> If the original image does **not** contain the EXIF orientation tag,
should we add it when images are rotated and saved? I don't think so, but
thought I'd ask.
You're right, we shouldn't.
> If an uploaded image has an EXIF orientation of anything other than
"normal" (e.g., 2, which means "flipped"), should we modify the image
accordingly on upload?
Yes. Thinking it is best to support all "orientations" that are possible
in EXIF, including "flip" and "mirror".
> If the original image contains an EXIF user comment tag (0x9286), the
value of that tag is **not** preserved. Why? Because GD overwrites it
with a string like "CREATOR: gd-jpeg v1.0 (using IJG JPEG v90), quality =
82." Should we worry about that?
Thinking "no", at least not in this ticket. This can be handled in another
ticket if deemed necessary.
Going through all previous comments, my opinion is that this patch
shouldn't introduce preserving of EXIF data in the images produced by GD.
There seems to be a possibility of corrupting the rotated image file if we
"patch it" on binary level.
Unfortunately there is no PHP extension/library that can (100% reliably)
write EXIF in JPEGs. Thinking it is better to avoid any possibility of
corrupting the user's images rather than try to do that by writing
directly to the files. This is also consistent with the current behaviour.
Of course it will preserve the EXIF when using ImageMagick. Thinking we
may also need to fix the image dimensions in the EXIF when we change it
from portrait to landscape, or the other way round. Not sure how useful it
would be.
This somewhat depends on #47873 but thinking we can do the same for images
that need rotation, i.e. create a new rotated image and use it as the
"full" size in WP, but keep the original image in case the user wants to
download it later. Also generally images that need rotation are photos
that will also need the "Big image" treatment.
In that terms thinking we should concentrate on how exactly to do the
rotating:
- Make a new "max-size" rotated image and then create all sub-sizes from
it.
- Rotate the (whole) original image and then make all sub-sizes (in one
go).
In both cases the rotation will have to be done from the function for
making sub-sizes so it uses less resources.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/14459#comment:77>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list