Skip to content

Commit

Permalink
Merge pull request #17 from GiritInteractive/CLOUDINARY-17
Browse files Browse the repository at this point in the history
CLOUDINARY-17: Added  option to  configuration in order to allow the …
  • Loading branch information
Pini authored Nov 27, 2018
2 parents d4cab97 + ec2acf9 commit 7fb804b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
6 changes: 3 additions & 3 deletions Core/Image/Transformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Cloudinary\Cloudinary\Core\Image;

use Cloudinary\Cloudinary\Core\Image\Transformation\Crop;
use Cloudinary\Cloudinary\Core\Image\Transformation\Dimensions;
use Cloudinary\Cloudinary\Core\Image\Transformation\Dpr;
use Cloudinary\Cloudinary\Core\Image\Transformation\FetchFormat;
use Cloudinary\Cloudinary\Core\Image\Transformation\Freeform;
use Cloudinary\Cloudinary\Core\Image\Transformation\Gravity;
use Cloudinary\Cloudinary\Core\Image\Transformation\Quality;
use Cloudinary\Cloudinary\Core\Image\Transformation\Crop;
use Cloudinary\Cloudinary\Core\Image\Transformation\Freeform;

class Transformation
{
Expand Down Expand Up @@ -87,7 +87,7 @@ public function build()
['raw_transformation' => (string)$this->freeform],
[
'fetch_format' => (string)$this->fetchFormat,
'quality' => (string)$this->quality,
'quality' => (string)$this->quality ?: null,
'crop' => (string)$this->crop,
'gravity' => (string)$this->gravity ?: null,
'width' => $this->dimensions ? $this->dimensions->getWidth() : null,
Expand Down
48 changes: 26 additions & 22 deletions Model/Config/Source/Dropdown/Quality.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,51 @@ class Quality implements OptionSourceInterface
{
public function toOptionArray()
{
return array(
array(
return [
[
'value' => '',
'label' => 'Magento\'s Default',
],
[
'value' => '20',
'label' => '20%',
),
array(
],
[
'value' => '30',
'label' => '30%',
),
array(
],
[
'value' => '40',
'label' => '40%',
),
array(
],
[
'value' => '50',
'label' => '50%',
),
array(
],
[
'value' => '60',
'label' => '60%',
),
array(
],
[
'value' => '70',
'label' => '70%',
),
array(
],
[
'value' => '80',
'label' => '80%',
),
array(
],
[
'value' => '90',
'label' => '90%',
),
array(
],
[
'value' => '100',
'label' => '100%',
),
array(
],
[
'value' => 'auto',
'label' => 'Auto',
)
);
]
];
}
}
2 changes: 1 addition & 1 deletion Model/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function getFetchFormat()
*/
public function getImageQuality()
{
return $this->configReader->getValue(self::CONFIG_DEFAULT_QUALITY);
return (string) $this->configReader->getValue(self::CONFIG_DEFAULT_QUALITY);
}

/**
Expand Down

0 comments on commit 7fb804b

Please sign in to comment.