Skip to content

Commit

Permalink
Add compression level to Image helper
Browse files Browse the repository at this point in the history
The legacy Image helper has everything needed to set a default compression level, but it doesn't use it at all. Setting the compression level will have absolutely no effect when an image is saved.
This small change fixes that.
  • Loading branch information
Nour Akalay committed Jan 9, 2015
1 parent 5ceb624 commit 1887aad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web/concrete/src/Legacy/ImageHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ public function create($mixed, $newPath, $width, $height, $fit = false)
$image = Image::open($mixed);
}
if ($fit) {
return $image->thumbnail(new Box($width, $height), ImageInterface::THUMBNAIL_OUTBOUND)->save($newPath);
return $image->thumbnail(new Box($width, $height), ImageInterface::THUMBNAIL_OUTBOUND)->save($newPath, array('quality'=>$this->jpegCompression));

} else {

if ($height < 1) {
$image->thumbnail($image->getSize()->widen($width))->save($newPath);
$image->thumbnail($image->getSize()->widen($width))->save($newPath, array('quality'=>$this->jpegCompression));
} else if ($width < 1) {
$image->thumbnail($image->getSize()->heighten($height))->save($newPath);
$image->thumbnail($image->getSize()->heighten($height))->save($newPath, array('quality'=>$this->jpegCompression));
} else {
$image->thumbnail(new Box($width, $height))->save($newPath);
$image->thumbnail(new Box($width, $height))->save($newPath, array('quality'=>$this->jpegCompression));
}
}
}
Expand Down

0 comments on commit 1887aad

Please sign in to comment.