Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cms page teaser image upload not working - absolute path instead of relative supplied to getImageUrl method #4

Open
CrazySquareRoot opened this issue Feb 21, 2023 · 1 comment

Comments

@CrazySquareRoot
Copy link

CrazySquareRoot commented Feb 21, 2023

Fix:

diff --git a/vendor/creativestyle/magesuite-opengraph/Service/Processor/UploadImage.php b/vendor/creativestyle/magesuite-opengraph/Service/Processor/UploadImage.php
index a1d00557..8d72cd7b 100644
--- a/vendor/creativestyle/magesuite-opengraph/Service/Processor/UploadImage.php
+++ b/vendor/creativestyle/magesuite-opengraph/Service/Processor/UploadImage.php
@@ -44,6 +44,9 @@ class UploadImage
         $path = $this->filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA)
             ->getAbsolutePath($path);

+        $relativePath = $this->filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA)
+            ->getRelativePath($path);
+
         $result = $uploader->save($path);

         $imagePath = $uploader->getUploadedFileName();
@@ -56,7 +59,7 @@ class UploadImage

         $result['tmp_name'] = str_replace('\\', '/', $result['tmp_name']);
         $result['path'] = str_replace('\\', '/', $result['path']);
-        $result['url'] = $this->cmsImageUrlProvider->getImageUrl($imagePath, $path);
+        $result['url'] = $this->cmsImageUrlProvider->getImageUrl($imagePath, $relativePath);
         $result['name'] = $result['file'];

         return $result;
--
2.25.1

getImageUrl clearly expects relative path.

@diwipl
Copy link
Contributor

diwipl commented Feb 21, 2023

Hi

Thank you for reporting the issue.

Actually, the issue is related to recent changes that we reverted just Today: magesuite/cms-tag-manager@6e270e7

After the update of cms-tag-manager upload should work back and images should be properly displayed on the frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants