diff --git a/Controller/Adminhtml/Ajax/Free/Sample.php b/Controller/Adminhtml/Ajax/Free/Sample.php index 39c3dd8..460f5a3 100644 --- a/Controller/Adminhtml/Ajax/Free/Sample.php +++ b/Controller/Adminhtml/Ajax/Free/Sample.php @@ -2,13 +2,13 @@ namespace Cloudinary\Cloudinary\Controller\Adminhtml\Ajax\Free; -use Cloudinary\Cloudinary\Core\Image\Transformation\Freeform; +use Cloudinary\Cloudinary\Core\ConfigurationInterface; use Cloudinary\Cloudinary\Core\Image\Transformation; +use Cloudinary\Cloudinary\Core\Image\Transformation\Freeform; +use Cloudinary\Cloudinary\Model\Config\Backend\Free as FreeBackendModel; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\Framework\Controller\Result\JsonFactory; -use Cloudinary\Cloudinary\Model\Config\Backend\Free as FreeBackendModel; -use Cloudinary\Cloudinary\Core\ConfigurationInterface; class Sample extends Action { @@ -76,7 +76,7 @@ public function execute() private function defaultTransformWithFreeTransform($freeTransform) { return $this->configuration->getDefaultTransformation() - ->withFreeform(Freeform::fromString($freeTransform)); + ->withFreeform(Freeform::fromString($freeTransform), false); } /** diff --git a/Model/Configuration.php b/Model/Configuration.php index 2805eab..3981ae3 100644 --- a/Model/Configuration.php +++ b/Model/Configuration.php @@ -199,7 +199,7 @@ public function getCdnSubdomainStatus() */ public function getUserPlatform() { - return sprintf(self::USER_PLATFORM_TEMPLATE, '1.9.6', '2.0.0'); + return sprintf(self::USER_PLATFORM_TEMPLATE, '1.9.7', '2.0.0'); } /** diff --git a/Plugin/Catalog/Block/Product/View/Gallery.php b/Plugin/Catalog/Block/Product/View/Gallery.php index 092017b..52d83ef 100644 --- a/Plugin/Catalog/Block/Product/View/Gallery.php +++ b/Plugin/Catalog/Block/Product/View/Gallery.php @@ -117,7 +117,14 @@ protected function getCloudinaryPGOptions($refresh = false, $ignoreDisabled = fa break; case 'video': if (strpos($value['videoUrl'], '.cloudinary.com/') !== false && strpos($value['videoUrl'], '/' . $this->productGalleryHelper->getCloudName() . '/') !== false) { - $publicId = @pathinfo($value['videoUrl'], PATHINFO_FILENAME) ?: null; + $publicId = $value['videoUrl']; + $publicId = preg_replace('/^.*\/' . $this->productGalleryHelper->getCloudName() . '\/video\/(upload\/)?/', '', $publicId); + $publicId = preg_replace('/\.[^.]+$/', '', $publicId); + $publicId = (array) preg_split('/\/v[0-9]{1,10}\//', $publicId); + if (count($publicId) > 1) { + $transformation = array_shift($publicId); + } + $publicId = implode('', $publicId); } break; } diff --git a/composer.json b/composer.json index 1e74fca..f6fa35c 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.9.6", + "version": "1.9.7", "license": "MIT", "require": { "cloudinary/cloudinary_php": "*" diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 8427b4f..45fd4ba 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -25,17 +25,18 @@ - Format should be: cloudinary://API_Key:API_Secret@Cloud_Name]]> + Format should be: cloudinary://API_Key:API_Secret@Cloud_Name]]> Cloudinary\Cloudinary\Model\Config\Backend\Credentials - + ]]> + validate-email - + 1 diff --git a/etc/module.xml b/etc/module.xml index ceca1da..c79bb8a 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - + diff --git a/marketplace.composer.json b/marketplace.composer.json index 0ce3f02..0867af0 100644 --- a/marketplace.composer.json +++ b/marketplace.composer.json @@ -1,7 +1,7 @@ { "name": "cloudinary/cloudinary", "type": "magento2-module", - "version": "1.9.6", + "version": "1.9.7", "description": "Cloudinary Magento 2 Integration.", "license": "MIT", "require": { diff --git a/view/adminhtml/web/js/get-video-information.js b/view/adminhtml/web/js/get-video-information.js index d02a2c7..b835f72 100644 --- a/view/adminhtml/web/js/get-video-information.js +++ b/view/adminhtml/web/js/get-video-information.js @@ -829,7 +829,7 @@ define( } } else if (href.host.match(/cloudinary\.com/)) { type = 'cloudinary'; - id = this._baseName(href.href); + id = href.href.replace(new RegExp('^.*\/video\/(upload\/)?((.*\/)?v[0-9]{1,10}\/)?'), '').replace(new RegExp('\.[^.]+$'), ''); } if ((!id || !type) && forceVideo) {