Comments (23)
I'm not sure where it should be integrated.
I'm not either.
Either the images should be rotated to the right orientation during the upload process
But this would modify the original file and re-encode the JPEG data. Is that always desired?
or the orientation should be taken into account with each resize.
This would make the resized images behave differently in the browser than the original file does. And we would also have to adapt all calls to getimagesize()
and rotate the values.
Sadly browsers themselves are inconsistent in handling this topic, see https://caniuse.com/#feat=css-image-orientation
I think the best option would be to make it optional. Either via a Setting like “Auto-rotate images on upload” or by adding a „repair“ button next to EXIF images in the file manager.
from image.
Either via a Setting like “Auto-rotate images on upload” or by adding a „repair“ button next to EXIF images in the file manager.
@contao/developers What do you think?
from image.
AFAIR we agreed that we don’t want to create an image editing software inside Contao. If we add a rotate feature we might also add cropping, resizing, contrast and many more.
I think the best solution would be to auto-rotate images on upload (based on the EXIF data) and make it possible to opt out with a global setting.
from image.
Only having an option to manually rotate an image wouldn't suffice - if your application accepts user uploaded images, that are then immediately displayed on the website.
from image.
- Always consider the EXIF orientation during resizing.
The longer I’m thinking about it, the more appealing it looks to me. We just have to run the lightbox images through the resizer too, and if it detects an EXIF orientation it should generate a rotated image instead of returning the original.
Should be fairly simple to implement in
Lines 139 to 142 in 93d47eb
from image.
I think auto rotation might confuse users who have no clue about EXIF. A repair button next to the image would allow us to provide additional information. A separate view could even allow for a setting where you could configure whether the original should be replaced or not etc.
from image.
+1 for always using the auto-rotate information if it is present. I cannot think of a use case where you would want to use a wrongly rotated image.
from image.
I think a repair button would be insufficient. Consider this use case: you provide a front end form with a file upload, where you directly upload an image from your smartphone camera. This uploaded file will then be shown directly in the front end - but it might have the wrong orientation.
In this case an option for the file upload form field to automatically transform the image would be the most practical one I think.
from image.
Rotating the image only during image resize would be insufficient, if you show the original image in a lightbox for example (e.g. through Contao's own text, image and gallery content element for example).
from image.
In this case an option for the file upload form field to automatically transform the image would be the most practical one I think.
I think a global setting that affects all image uploads should be sufficient, don’t you think?
from image.
Fine by me. I personally can't think of a use case where I would want to keep the original image anyway :)
from image.
Why not simply add a rotate feature? This would also allow to fix images that do not have EXIF data but are incorrectly rotated.
from image.
I think the best solution would be to auto-rotate images on upload (based on the EXIF data) and make it possible to opt out with a global setting.
Maybe we should add a switch to respect the orientation from the EXIF data either during upload or image resizing (in the frontend).
I never let Contao resize images on upload. Always keep the original and resize for the frontend output.
For example the nextcloud project saves the original images (as the goal is to share files) but shows an preview for jpg files. And that's pretty fast.
So I recommend a global setting to fix(?) orientation during upload (based on EXIF data, but then the EXIF data will be lost or have to be rewritten) or store the (resized) image with orignal orientation (with original EXIF data) and take the orientation into account when resizing in the frontend.
from image.
or store the (resized) image with orignal orientation (with original EXIF data) and take the orientation into account when resizing in the frontend.
This would not work well, see #44 (comment) and #44 (comment)
from image.
This would not work well, see #44 (comment) and #44 (comment)
If I'm going to show the original (uploaded) image, then I should resize and orientate images during upload (as I would do in my Imageprogram when preparing images for the web). We can't cover every situation.
IMO the orientation information of an image should always be used when resizing - which is the same as building a new image (without EXIF) from the original (with EXIF), but with different dimension. See also #44 (comment).
Maybe it's enough to have it optional to 'auto-rotate' images when resizing (if EXIF orientation info is present). This will happen when images are uploaded and(!) resized or when the images will be resized during frontend output.
from image.
If I'm going to show the original (uploaded) image, then I should resize and orientate images during upload (as I would do in my Imageprogram when preparing images for the web). We can't cover every situation.
Uploading an image via the front end form and then displaying all uploaded images in a gallery content element should be a fairly straight forward use case. And for this case the original image must be transformed directly after uploading.
from image.
Uploading an image via the front end form and then displaying all uploaded images in a gallery content element should be a fairly straight forward use case
I don't see a problem here.
If 'auto-rotation' is enabled and images will be resized during upload, all fixed.
If 'auto-rotation' is enabled and images will not be resized during upload but(!) a resized preview image will be shown in a gallery content element, fixed too.
If the original image is shown directly then you have to be sure all images (with EXIF orientation) have to be resized.
But a forced orientation transform when uploading images (whether they are resized or not) should be avoided, because there will be ever a loss of quality. For this use case we can add an extra option in the front end upload form/module.
from image.
If 'auto-rotation' is enabled and images will not be resized during upload but(!) a resized preview image will be shown in a gallery content element, fixed too.
No, the image will be wrong in the lightbox.
from image.
I suggest the following.
- Always consider the EXIF orientation during resizing.
- Add an option to force re(orientation) on upload.
from image.
2\. Add an option to force re(orientation) on upload.
That's what we already suggested ;)
from image.
That's what we already suggested ;)
Well, then we're in agreement ;-)
Sometimes I'm somewhat sluggish in my head.
I just wanted to be sure that images could be uploaded without being changed automatically.
from image.
just stumbled about this css
#boxContent img {
image-orientation: from-image;
}
Unfortunately not the greatest support yet https://caniuse.com/#feat=css-image-orientation :(
I'm not the biggest fan of irreversible altering user-uploaded content but an option might be ok.
from image.
Closed in favor of #52
from image.
Related Issues (20)
- Remove EXIF data and convert to RGB by default HOT 1
- Add compatibility with imagine 0.7
- Bug with resize configuration HOT 5
- Improve zlib stream test HOT 3
- Problem with responsive images HOT 5
- Image attributes partial override HOT 1
- unexpected behaviour with svg-images and image-sizes HOT 4
- behavior of responsive images when original image is smaller than target size HOT 28
- Wrong access rights for created pictures HOT 1
- Race condition
- Symlinked cache directory resolves to invalid paths HOT 1
- Invalid UTF-8 paths result in empty JSON files HOT 1
- Gmagick does not like tempnam without file extension HOT 10
- Prevent resizing of images when resize mode is proportional and width and height of the image equal HOT 2
- IPTC/EXIF metadata get lost when resizing images in Contao HOT 62
- Length of either side cannot be 0 or negative, current size is 2x0
- Add more resize modes HOT 5
- Use symfony/filesystem instead of webmozart/path-util HOT 10
- Improve security of image filenames HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image.