Skip to content

Commit 1d2311c

Browse files
author
Pniel (Pini) Cohen
authored
Merge pull request #64 from cloudinary/v1.11.3
v1.11.3
2 parents 25e82fb + 75e8b7d commit 1d2311c

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

Block/Adminhtml/Cms/Wysiwyg/Images/Content.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,19 @@ public function getCloudinaryMediaLibraryWidgetOptions($multiple = false, $refre
4848
if (!($cloudinaryMLoptions = $this->mediaLibraryHelper->getCloudinaryMLOptions($multiple, $refresh))) {
4949
return null;
5050
}
51+
52+
try {
53+
//Try to add session param on Magento versions prior to 2.3.5
54+
$imageUploadUrl = $this->_urlBuilder->addSessionParam()->getUrl('cloudinary/cms_wysiwyg_images/upload', ['type' => $this->_getMediaType()]);
55+
} catch (\Exception $e) {
56+
//Catch deprecation error on Magento 2.3.5 and above
57+
$imageUploadUrl = $this->_urlBuilder->getUrl('cloudinary/cms_wysiwyg_images/upload', ['type' => $this->_getMediaType()]);
58+
}
59+
5160
return $this->_jsonEncoder->encode(
5261
[
5362
'cldMLid' => 'wysiwyg_media_gallery',
54-
'imageUploaderUrl' => $this->_urlBuilder->addSessionParam()->getUrl('cloudinary/cms_wysiwyg_images/upload', ['type' => $this->_getMediaType()]),
63+
'imageUploaderUrl' => $imageUploadUrl,
5564
'triggerSelector' => '.media-gallery-modal',
5665
'triggerEvent' => 'fileuploaddone',
5766
'cloudinaryMLoptions' => $cloudinaryMLoptions,

Block/Adminhtml/Product/Helper/Form/Gallery/Content.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,20 @@ public function getCloudinaryMediaLibraryWidgetOptions($multiple = true, $refres
6464
if (!($cloudinaryMLoptions = $this->mediaLibraryHelper->getCloudinaryMLOptions($multiple, $refresh))) {
6565
return null;
6666
}
67+
68+
try {
69+
//Try to add session param on Magento versions prior to 2.3.5
70+
$imageUploadUrl = $this->_urlBuilder->addSessionParam()->getUrl('cloudinary/ajax/retrieveImage');
71+
} catch (\Exception $e) {
72+
//Catch deprecation error on Magento 2.3.5 and above
73+
$imageUploadUrl = $this->_urlBuilder->getUrl('cloudinary/ajax/retrieveImage');
74+
}
75+
6776
return $this->_jsonEncoder->encode(
6877
[
6978
'htmlId' => $this->getHtmlId(),
7079
'cldMLid' => 'product_gallery_' . $this->getHtmlId(),
71-
'imageUploaderUrl' => $this->_urlBuilder->addSessionParam()->getUrl('cloudinary/ajax/retrieveImage'),
80+
'imageUploaderUrl' => $imageUploadUrl,
7281
'triggerSelector' => '#media_gallery_content',
7382
'triggerEvent' => 'addItem',
7483
'useDerived' => false,

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cloudinary/cloudinary-magento2",
33
"description": "Cloudinary Magento 2 Integration.",
44
"type": "magento2-module",
5-
"version": "1.11.2",
5+
"version": "1.11.3",
66
"license": "MIT",
77
"require": {
88
"cloudinary/cloudinary_php": "*"

etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="Cloudinary_Cloudinary" setup_version="1.11.2">
3+
<module name="Cloudinary_Cloudinary" setup_version="1.11.3">
44
<sequence>
55
<module name="Magento_ProductVideo"/>
66
</sequence>

marketplace.composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cloudinary/cloudinary",
33
"description": "Cloudinary Magento 2 Integration.",
44
"type": "magento2-module",
5-
"version": "1.11.2",
5+
"version": "1.11.3",
66
"license": "MIT",
77
"require": {
88
"cloudinary/cloudinary_php": "*"

0 commit comments

Comments
 (0)