Skip to content

Commit

Permalink
:octocat: don't optimize base images
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Jun 21, 2018
1 parent 5e97e8c commit d851933
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Imagetiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ protected function prepareZoomBaseImages(string $image_path, string $out_path):v
// resizeImage - works slower but offers better quality
: $il->resizeImage($w, $h, $this->options->resize_filter, $this->options->resize_blur);

$this->saveImage($il, $base_image);
// save without optimizing
$this->saveImage($il, $base_image, false);

if($start){
$this->clearImage($im);
Expand Down Expand Up @@ -265,7 +266,7 @@ protected function createTilesForZoom(Imagick $im, int $zoom, string $out_path,
$ti->extentImage($ts, $ts, 0, $th);
}

$this->saveImage($ti, $tile, $optimizer);
$this->saveImage($ti, $tile, true);
$this->clearImage($ti);
}

Expand All @@ -280,13 +281,14 @@ protected function createTilesForZoom(Imagick $im, int $zoom, string $out_path,
/**
* save image in to destination
*
* @param Imagick $image
* @param string $dest full path with file name
* @param Imagick $image
* @param string $dest full path with file name
* @param bool $optimize
*
* @return void
* @throws \chillerlan\Imagetiler\ImagetilerException
*/
protected function saveImage(Imagick $image, string $dest):void{
protected function saveImage(Imagick $image, string $dest, bool $optimize):void{
$dir = dirname($dest);

if(!is_dir($dir)){
Expand All @@ -304,7 +306,7 @@ protected function saveImage(Imagick $image, string $dest):void{
throw new ImagetilerException('cannot save image '.$dest);
}

if($this->options->optimize_output && $this->optimizer instanceof Optimizer){
if($this->options->optimize_output && $optimize && $this->optimizer instanceof Optimizer){
$this->optimizer->optimize($dest);
}

Expand Down

0 comments on commit d851933

Please sign in to comment.