Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronen-Michaeli-22 committed Jun 16, 2024
2 parents 8eae893 + 4ce6d50 commit 0114124
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Helper/ProductGalleryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function getCloudinaryPGOptions($refresh = false, $ignoreDisabled = false
$transformation = [];
$videoSettings = $this->configuration->getAllVideoSettings();
$videoFreeParams = $videoSettings['video_free_params'] ?? null;
$videoControls = $videoSettings['controls'] ?? null;
if ($videoFreeParams) {
$config = json_decode($videoFreeParams, true);
$config = array_shift($config);
Expand All @@ -86,13 +87,13 @@ public function getCloudinaryPGOptions($refresh = false, $ignoreDisabled = false
if (!$videoFreeParams || $videoFreeParams == "{}") {
$config = [
'playerType' => 'cloudinary',
'controls' => $videoSettings['controls'],
'controls' => $videoControls,
'chapters' => false,
'muted' => false

];
$autoplayMode = $videoSettings['autoplay'] ?? null;
$config['autoplayMode'] = $videoSettings['autoplay'];
$config['autoplayMode'] = $autoplayMode;
if ($autoplayMode && $autoplayMode != 'never') {
$config['autoplay'] = true;

Expand Down
8 changes: 6 additions & 2 deletions Plugin/Catalog/Block/Product/View/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ public function beforeToHtml(\Magento\Catalog\Block\Product\View\Gallery $produc
$productGalleryBlock->setCldPGid($this->getCldPGid());
}
}

public function getCname()
{
$config = $this->configuration->getCredentials();
return ($config['cname']) ?? '';
}
public function getHtmlId()
{
if (!$this->htmlId) {
Expand Down Expand Up @@ -167,7 +171,7 @@ protected function getCloudinaryPGOptions($refresh = false, $ignoreDisabled = fa
} elseif ($value['type'] === 'video') {
$url = $value['videoUrl'];
}
if (\strpos($url, '.cloudinary.com/') !== false && (strpos($url, '/' . $this->productGalleryHelper->getCloudName() . '/') !== false || strpos($url, '://' . $this->productGalleryHelper->getCloudName()) !== false)) {
if ((strpos($url, '.cloudinary.com/') !== false) && (strpos($url, '/' . $this->productGalleryHelper->getCloudName() . '/') !== false || strpos($url, '://' . $this->productGalleryHelper->getCloudName()) !== false) || strpos($url, $this->getCname()) !== false) {
$parsed = $this->configuration->parseCloudinaryUrl($url);
$publicId = ($value['type'] === 'image') ? $parsed['publicId'] . '.' . $parsed['extension'] : $parsed['publicId'];
$transformation = \str_replace('/', ',', $parsed['transformations_string']);
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.20.0",
"version": "1.20.1",
"license": "MIT",
"require": {
"cloudinary/cloudinary_php": ">=2.7 <=2.11.0"
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<field id="cloudinary_environment_variable" translate="label comment" type="obscure" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Cloudinary Account Credentials</label>
<comment>
<![CDATA[Set your Cloudinary account credentials. Copy the "Environment variable" string from the dashboard of <a href="https://cloudinary.com/console" target="_blank" title="Cloudinary's Management Console">Cloudinary's Management Console</a>.<br>Format should be: cloudinary://API_Key:API_Secret@Cloud_Name]]>
<![CDATA[Copy the <b>API environment variable</b> format from the <a href="https://console.cloudinary.com/settings/api-keys" target="_blank">API Keys</a> page. Replace [your_api_key] and [your_api_secret] with your actual values, while your cloud name is already correctly included in the format.]]>
</comment>
<backend_model>Cloudinary\Cloudinary\Model\Config\Backend\Credentials</backend_model>
</field>
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.20.0">
<module name="Cloudinary_Cloudinary" setup_version="1.20.1">
<sequence>
<module name="Magento_ProductVideo"/>
<module name="Magento_PageBuilder"/>
Expand Down

0 comments on commit 0114124

Please sign in to comment.