Skip to content

Commit

Permalink
Merge pull request #25 from maxprihodko8/patch-3
Browse files Browse the repository at this point in the history
Added better quality for uploaded images
  • Loading branch information
krivochenko authored Nov 1, 2017
2 parents 31ff1e0 + 05e5adc commit 67190a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion actions/UploadAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,14 @@ public function run()
)->resize(
new Box($width, $height)
);

if (!file_exists($this->path) || !is_dir($this->path)) {
$result = [
'error' => Yii::t('cropper', 'ERROR_NO_SAVE_DIR')]
;
}

if ($image->save($this->path . $model->{$this->uploadParam}->name)) {
if ($image->save($this->path . $model->{$this->uploadParam}->name), ['jpeg_quality' => 100, 'png_compression_level' => 1]) {
$result = [
'filelink' => $this->url . $model->{$this->uploadParam}->name
];
Expand Down

0 comments on commit 67190a7

Please sign in to comment.