Goomento / PageBuilder

Goomento - The Free Magento Page Builder Extension, that allows you to create unique Magento websites using advanced animations, custom CSS, responsive designs, and more, by performing simple actions such as drag and drop.
https://goomento.com
Open Software License 3.0
90 stars 16 forks source link

Image Upload not working #12

Closed comworks-group closed 2 years ago

comworks-group commented 2 years ago

System: Debian 11 Web: Apache 2.4 PHP : PHP 7.2.34 Platform: Magento 2.3.3 pl1 Version: Goomento 0.2.9 Issues: When adding image to builder i can select the image to be attach, however UI is loading only with the attach error on the web console.

I also create the following folder

magento dir / media/goomento magento dir / pub/media/goomento

with 777 permission.

goomento

haihv433 commented 2 years ago

Hi @comworks-group

Thanks for let me know the issue,

I will try to replicate and fix it ASAP

haihv433 commented 2 years ago

Hi @comworks-group

I checked around and believe you did set this configuration to Yes

Use Static URLs for Media Content in WYSIWYG -> Yes

Reference Configure static media URLs

For the quick fix, you can turn to No then able to build your landing page via Goomento Editor

or applying this patch

diff --git a/view/adminhtml/web/js/media-bucket/uploader.js b/view/adminhtml/web/js/media-bucket/uploader.js
index 055e225..a7ebfcb 100644
--- a/view/adminhtml/web/js/media-bucket/uploader.js
+++ b/view/adminhtml/web/js/media-bucket/uploader.js
@@ -49,15 +49,16 @@ define([
         _getFileUrl: function (rawUrl) {
             let matched = rawUrl.match(/___directive\/([a-zA-Z0-9,]*)/i),
                 url = '';
-            if (matched[1]) {
+            if (matched && matched[1]) {
                 let widget = Base64.mageDecode(matched[1]);
                 widget = widget.match(/url=\"([^"]+)\"/i);
                 if (widget[1]) {
                     url = widget[1];
                 }
+                return mediaUrl + url;
+            } else {
+                return rawUrl;
             }
-
-            return mediaUrl + url;
         },
         initialize: function (model) {
             this.setModel(model);

The permanent fix for this issue will be release in the next version,

Let me know the the issue still persist

Thanks

comworks-group commented 2 years ago

Will apply your suggested patch

comworks-group commented 2 years ago

Hi @haihv433, I tried your suggested patch. But same concern, i tried to issue upgrade, compile, static-content-deploy, flush cache, and reindex.

Edited uploader.js goomento

Console Error: goomento2

Admin Setting: goomento3

haihv433 commented 2 years ago

Did you clean browser cache @comworks-group ?

image

Choose Disable cache here then give it a re-try

Or try to add debugger/ breakpoint as reference here JavaScript debugging reference right below the _getFileUrl and It's the same as the code you wrote ?

comworks-group commented 2 years ago

Hi @haihv433, Thank you for giving hints how to resolve. I can now upload image, however image is not displayed. The generated link is not correct.

Sample: Image is upload in magento file manager, and reside in root_dir/goomento/image.jpg The generated image link is

https://((URL))/index.php/goomento/image.jpg --> return http 404

Generated link should be https://((URL))/index.php/pub/media/goomento/image.jpg --> image is accessible.

How can i address this?

haihv433 commented 2 years ago

@comworks-group Looks like your site has been customized, haven't it? the mediaUrl (in the media-bucket/uploader.js) did not get the proper value of media folder via HTTP

For this such a case, I think you better turn this configuration On

Use Static URLs for Media Content in WYSIWYG -> Yes

or set mediaUrl to your media url (hard code) for a quick fix,

comworks-group commented 2 years ago

@haihv433 After setting Use Static URLs for Media Content in WYSIWYG to Yes image is not visible in the UI.

We can now close this issue, will wait for your next released for the fix.

Thank you