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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only process fixOrientation if the image is jpg/tiff #109

Merged
merged 2 commits into from Jun 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Adapter/Common.php
Expand Up @@ -95,6 +95,10 @@ public function cropResize($width = null, $height = null, $background = 'transpa
*/
public function fixOrientation()
{
if (!in_array(exif_imagetype($this->source->getInfos()), array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM))) {
return $this;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to throw an unsupported image type exception IMO.

@Gregwar what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm against raising an exception because in my use case I get a list of image manipulation actions in a row, and then execute them all regardless of the file type (I don't know it yet when adding the actions), so returning $this and continuing execution for me is essential.

}

if (!extension_loaded('exif')) {
throw new \RuntimeException('You need to EXIF PHP Extension to use this function');
}
Expand Down