Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RonenGirit committed Feb 7, 2023
2 parents e69bc91 + ea137b0 commit 48dc7fb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Core/CloudinaryImageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public function upload(Image $image)
(string)$image,
$this->configuration->getUploadConfig()->toArray() + [ "folder" => $image->getRelativeFolder()]
);
if (isset($uploadResult['public_id'])) {
$publicIds = [$uploadResult['public_id']];
$metadata = "cld_mag_plugin=1";
$this->uploader->addContext($metadata, $publicIds);
}
return $this->uploadResponseValidator->validateResponse($image, $uploadResult);
} catch (\Exception $e) {
ApiError::throwWith($image, $e->getMessage());
Expand Down
7 changes: 5 additions & 2 deletions Plugin/Ui/Component/Form/Element/DataType/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ protected function isGallerySupported()
*/
public function afterPrepare(\Magento\Ui\Component\Form\Element\DataType\Media $component, $result = null)
{
if ($this->appState->getAreaCode() === Area::AREA_ADMINHTML && ($cloudinaryMLoptions = $this->mediaLibraryHelper->getCloudinaryMLOptions(false))) {
$uploaderConfigUrl = $component->getData('config/uploaderConfig/url');
if ($this->appState->getAreaCode() === Area::AREA_ADMINHTML
&& ($cloudinaryMLoptions = $this->mediaLibraryHelper->getCloudinaryMLOptions(false))
&& ($uploaderConfigUrl = $component->getData('config/uploaderConfig/url'))
) {

if (strpos($uploaderConfigUrl, '/design_config_fileUploader/') !== false) {
$type = 'design_config_fileUploader';
} elseif (strpos($uploaderConfigUrl, '/category_image/') !== false) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cloudinary/cloudinary-magento2",
"description": "Cloudinary Magento 2 Integration.",
"type": "magento2-module",
"version": "1.19.3",
"version": "1.19.4",
"license": "MIT",
"require": {
"cloudinary/cloudinary_php": ">=2.7 <2.8.1",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Cloudinary_Cloudinary" setup_version="1.19.3">
<module name="Cloudinary_Cloudinary" setup_version="1.19.4">
<sequence>
<module name="Magento_ProductVideo"/>
<module name="Magento_PageBuilder"/>
Expand Down

0 comments on commit 48dc7fb

Please sign in to comment.