diff --git a/Core/CloudinaryImageProvider.php b/Core/CloudinaryImageProvider.php
index f54bc3e..64aabeb 100644
--- a/Core/CloudinaryImageProvider.php
+++ b/Core/CloudinaryImageProvider.php
@@ -92,7 +92,11 @@ public function upload(Image $image)
*/
public function retrieveTransformed(Image $image, Transformation $transformation)
{
- $imagePath = \cloudinary_url($image->getId(), ['transformation' => $transformation->build(), 'secure' => true]);
+ $imagePath = \cloudinary_url($image->getId(), [
+ 'transformation' => $transformation->build(),
+ 'secure' => true,
+ 'sign_url' => $this->configuration->getUseSignedUrls()
+ ]);
if ($this->configuration->getUseRootPath()) {
$imagePath = str_replace(".com/{$this->configuration->getCloud()}/image/upload/", ".com/{$this->configuration->getCloud()}/", $imagePath);
diff --git a/Core/Image/Transformation.php b/Core/Image/Transformation.php
index bbd9afa..5a588f5 100644
--- a/Core/Image/Transformation.php
+++ b/Core/Image/Transformation.php
@@ -23,14 +23,14 @@ class Transformation
public function __construct()
{
- $this->crop = 'pad';
+ $this->crop = 'lpad';
$this->flags = [];
}
public function withGravity(Gravity $gravity)
{
$this->gravity = $gravity;
- $this->crop = ((string)$gravity) ? 'crop' : 'pad';
+ $this->crop = ((string)$gravity) ? 'crop' : 'lpad';
return $this;
}
diff --git a/Core/Image/Transformation/Crop.php b/Core/Image/Transformation/Crop.php
index 1609533..e48560a 100644
--- a/Core/Image/Transformation/Crop.php
+++ b/Core/Image/Transformation/Crop.php
@@ -4,7 +4,7 @@
class Crop
{
- const PAD = 'pad';
+ const PAD = 'lpad';
const FIT = 'fit';
private $value;
diff --git a/Model/Configuration.php b/Model/Configuration.php
index 386afa7..ce647b8 100644
--- a/Model/Configuration.php
+++ b/Model/Configuration.php
@@ -40,6 +40,7 @@ class Configuration implements ConfigurationInterface
const CONFIG_PATH_SECURE_BASE_URL = "web/secure/base_url";
const CONFIG_PATH_UNSECURE_BASE_URL = "web/unsecure/base_url";
const CONFIG_PATH_USE_SECURE_IN_FRONTEND = "web/secure/use_in_frontend";
+ const CONFIG_PATH_USE_SIGNED_URLS = 'cloudinary/advanced/use_signed_urls';
const USE_FILENAME = true;
const UNIQUE_FILENAME = false;
@@ -158,7 +159,7 @@ public function getCdnSubdomainStatus()
*/
public function getUserPlatform()
{
- return sprintf(self::USER_PLATFORM_TEMPLATE, '1.6.4', '2.0.0');
+ return sprintf(self::USER_PLATFORM_TEMPLATE, '1.6.5', '2.0.0');
}
/**
@@ -279,6 +280,14 @@ public function getUseRootPath()
return (bool) $this->configReader->getValue(self::CONFIG_PATH_REMOVE_VERSION_NUMBER);
}
+ /**
+ * @return bool
+ */
+ public function getUseSignedUrls()
+ {
+ return (bool) $this->configReader->getValue(self::CONFIG_PATH_USE_SIGNED_URLS);
+ }
+
/**
* @method getMediaBaseUrl
* @return string
diff --git a/Plugin/ImageHelper.php b/Plugin/ImageHelper.php
index ebfdebb..6cb8141 100644
--- a/Plugin/ImageHelper.php
+++ b/Plugin/ImageHelper.php
@@ -2,16 +2,16 @@
namespace Cloudinary\Cloudinary\Plugin;
-use Cloudinary\Cloudinary\Core\Image\Transformation;
+use Cloudinary\Cloudinary\Core\ConfigurationInterface;
use Cloudinary\Cloudinary\Core\Image\ImageFactory;
-use Cloudinary\Cloudinary\Core\Image\Transformation\Dimensions;
+use Cloudinary\Cloudinary\Core\Image\Transformation;
use Cloudinary\Cloudinary\Core\Image\Transformation\Crop;
+use Cloudinary\Cloudinary\Core\Image\Transformation\Dimensions;
use Cloudinary\Cloudinary\Core\UrlGenerator;
-use Cloudinary\Cloudinary\Core\ConfigurationInterface;
-use Magento\Catalog\Api\Data\ProductInterface;
-use Magento\Catalog\Helper\Image as CatalogImageHelper;
use Cloudinary\Cloudinary\Model\Transformation as TransformationModel;
use Cloudinary\Cloudinary\Model\TransformationFactory;
+use Magento\Catalog\Api\Data\ProductInterface;
+use Magento\Catalog\Helper\Image as CatalogImageHelper;
class ImageHelper
{
@@ -158,7 +158,7 @@ private function createTransformation(CatalogImageHelper $helper)
$transform = $this->configuration->getDefaultTransformation()->withDimensions($dimensions);
if ($this->keepFrame) {
- $transform->withCrop(Crop::fromString('pad'))
+ $transform->withCrop(Crop::fromString('lpad'))
->withDimensions(Dimensions::squareMissingDimension($dimensions));
} else {
$transform->withCrop(Crop::fromString('fit'));
diff --git a/composer.json b/composer.json
index f8ecab8..84c397c 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "cloudinary/cloudinary-magento2",
"description": "Cloudinary Magento 2 Integration.",
"type": "magento2-module",
- "version": "1.6.4",
+ "version": "1.6.5",
"minimum-stability": "dev",
"license": "MIT",
"repositories": {
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 58e36b6..5dda429 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -77,6 +77,11 @@
Remove "/image/upload/" from URLs
Magento\Config\Model\Config\Source\Yesno
+
+
+ A signed Cloudinary image delivery URL is a dynamic URL that has its signature validated before making it available for view
+ Magento\Config\Model\Config\Source\Yesno
+
diff --git a/etc/module.xml b/etc/module.xml
index 6f38d9f..2b6982b 100644
--- a/etc/module.xml
+++ b/etc/module.xml
@@ -1,6 +1,6 @@
-
+