Skip to content

Commit

Permalink
Merge pull request #61 from jdecool/feature/fix-image-orientation
Browse files Browse the repository at this point in the history
Add option to fix image orientation by reading EXIFF data
  • Loading branch information
skwi committed Mar 23, 2015
2 parents 553b426 + 4e53a9d commit 225c7e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Manager/ResizeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ public function transform($sourcePath, $destPathWithFormat, $format)
*/
public static function resize($sourcePath, $destPathWithFormat, $dim)
{
$layer = ImageWorkshop::initFromPath($sourcePath);
$fixOrientation = (isset($dim['fix_orientation'])) ? $dim['fix_orientation'] : false;

$layer = ImageWorkshop::initFromPath($sourcePath, $fixOrientation);
$initSize = array(
'width' => $layer->getWidth(),
'height' => $layer->getHeight(),
Expand Down Expand Up @@ -199,7 +201,7 @@ public static function resize($sourcePath, $destPathWithFormat, $dim)
true,
null,
$dim['quality']
);
);

$layer = null;
}
Expand Down
1 change: 1 addition & 0 deletions Resources/doc/03-working-with-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ to add a `getCustomPath` method to your entity
* *crop_position* : [String - Default: 'MM'] Crop image position (L = left, T = top, M = middle, B = bottom, R = right)
* *bg_color* : [String - Default: '#FFFFFF'] Background color when image does not fill expected output size
* *enlarge* : [Boolean - Default: false] Enlarge image when source is smaller than output. Fill with bg_color when false
* *fix_orientation* : [Boolean - Default: false] Fix image orientation by reading orientation EXIFF data
* *height* : [Number - Default: 0] Height (if not square)
* *keep_proportions* : [Boolean - Default: true] Keep source image proportions (and fill with blank if needed)
* *max_height* : [Number - Default: 0] Resize to fit non square at maximum
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"symfony/framework-bundle": ">=2.5.0",
"symfony/form": ">=2.5.0",
"symfony/property-access": ">=2.5.0",
"sybio/image-workshop": "2.0.*@dev"
"sybio/image-workshop": "~2.0"
},
"require-dev": {
"atoum/atoum": "~1.2",
Expand Down

0 comments on commit 225c7e2

Please sign in to comment.