Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autorotate images based on EXIF metadata #52

Merged
merged 8 commits into from Jul 2, 2019

Conversation

Projects
None yet
4 participants
@ausi
Copy link
Member

commented Jun 18, 2019

As discussed in #44 (comment) we want to automatically rotate images if they have an EXIF IFD0-Orientation tag.

I also added a force-re-encoding flag that might be useful to get the benefits of resizing (like to-RGB-conversion, interlacing, metadata-stripping, sampling factors and specific JPEG-quality) even if no resize is required. (cc @agoat)

ToDo

  • Is forceReEncoding the correct name for this flag? reEncodeImageEvenIfNoResizeIsRequired seems too long 馃槈
  • Create a pull request for Contao 4.8 to let lightbox images run through the image factory so that they get EXIF rotated too.

@ausi ausi force-pushed the ausi:feature/exif-autorotation branch from 2638c48 to 2d8be88 Jun 18, 2019

@ausi

This comment has been minimized.

Copy link
Member Author

commented Jun 21, 2019

Related pull request in contao/contao: contao/contao#529

Show resolved Hide resolved src/ResizeOptions.php Outdated
* Insert an EXIF header into the passed JPEG data with the specified orientation.
*/
private function addImageOrientation(string $jpegData, int $orientation): string
{

This comment has been minimized.

Copy link
@Toflar

Toflar Jun 25, 2019

Member

For the next rewiever: there鈥榮 no PHP exif function that allows to write this data.

Show resolved Hide resolved .appveyor.yml

@ausi ausi merged commit 4ba0f26 into contao:master Jul 2, 2019

3 checks passed

Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
coverage/coveralls Coverage increased (+0.08%) to 98.285%
Details

leofeyer added a commit to contao/contao that referenced this pull request Jul 3, 2019

Autorotate images based on their EXIF metadata (see #529)
Description
-----------

Depends on ~~contao/image#52 and ~~#537~~

As discussed in contao/image#44 (comment) we want to automatically rotate images if they have an EXIF IFD0-Orientation tag.

Because lighbox images now run through the resizer too I added a ~~`contao.image.lightbox_size` configuration~~ `lightboxSize` layout setting where you can define the (maximum) size of your lightbox images. This can be overwritten by providing an `$arrItem['lightboxSize']` to the `addImageToTemplate()` method.

I also added a ~~`contao.image.force_re_encoding` configuration~~ `skipIfDimensionsMatch` flag to the image size settings, this might be useful to get the benefits of resizing (like to-RGB-conversion, interlacing, metadata-stripping, sampling factors and specific JPEG-quality) even if no resize is required. (Related: contao/core-bundle#636)

~~Any opinions on the naming of `lightbox_size` and `force_re_encoding`?~~

Commits
-------

51c1fd6 Autorotate images based on EXIF metadata
3798184 Add contao.image.lightbox_size configuration
39b3cef Add image.force_re_encoding configuration
4fb9ea2 Use the autorotation branch of contao/image
6fc4dba Fix tests
a6d92a2 Move force_re_encoding flag to size configuration
689fd3e Move lightbox_size to layout configuration
3e0fb0f Add translation messages
bae425f Improve skipIfDimensionsMatch description
cb6395e Fix phpstan issues
c3b981b Add $arrItem['lightboxSize'] parameter
32cffec Fix composer.json
f247946 Fix typo
aa83d03 Rename forceReEncoding to inverted skipIfDimensionsMatch
ee41741 Use 1.0.0-beta2 version of contao/image
14433cf Add skipIfDimensionsMatch to predefined sizes
5ec5af1 Remove leftover lightbox_size configuration
610264d Fix issues from rebase
aea51f4 Fix the coding style

leofeyer added a commit to contao/core-bundle that referenced this pull request Jul 3, 2019

Autorotate images based on their EXIF metadata (see #529)
Description
-----------

Depends on ~~contao/image#52 and ~~#537~~

As discussed in contao/image#44 (comment) we want to automatically rotate images if they have an EXIF IFD0-Orientation tag.

Because lighbox images now run through the resizer too I added a ~~`contao.image.lightbox_size` configuration~~ `lightboxSize` layout setting where you can define the (maximum) size of your lightbox images. This can be overwritten by providing an `$arrItem['lightboxSize']` to the `addImageToTemplate()` method.

I also added a ~~`contao.image.force_re_encoding` configuration~~ `skipIfDimensionsMatch` flag to the image size settings, this might be useful to get the benefits of resizing (like to-RGB-conversion, interlacing, metadata-stripping, sampling factors and specific JPEG-quality) even if no resize is required. (Related: #636)

~~Any opinions on the naming of `lightbox_size` and `force_re_encoding`?~~

Commits
-------

51c1fd67 Autorotate images based on EXIF metadata
3798184e Add contao.image.lightbox_size configuration
39b3cef1 Add image.force_re_encoding configuration
4fb9ea21 Use the autorotation branch of contao/image
6fc4dba0 Fix tests
a6d92a23 Move force_re_encoding flag to size configuration
689fd3ed Move lightbox_size to layout configuration
3e0fb0fb Add translation messages
bae425f4 Improve skipIfDimensionsMatch description
cb6395e5 Fix phpstan issues
c3b981b9 Add $arrItem['lightboxSize'] parameter
32cffecd Fix composer.json
f247946b Fix typo
aa83d030 Rename forceReEncoding to inverted skipIfDimensionsMatch
ee41741d Use 1.0.0-beta2 version of contao/image
14433cfa Add skipIfDimensionsMatch to predefined sizes
5ec5af10 Remove leftover lightbox_size configuration
610264da Fix issues from rebase
aea51f4d Fix the coding style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.