0

I've got a problem when adding images through the page-builder. When I open the gallery in the builder I see all images in the image gallery.

When I select the image, I get an broken image because the url changed.

This link is not working: https://www.elingscraftbeerdrinks.shop/media/.renditions/wysiwyg/Bestellijst.jpg

When I remove the .renditions part, the image is working correctly: https://www.elingscraftbeerdrinks.shop/media/wysiwyg/Bestellijst.jpg

Does someone know what is causing the problem and how to fix this?

Extra info: All product images are working fine.

Kind regards, Nick

2
  • Magento version ?
    – MP Raj
    Aug 8, 2023 at 7:19
  • Magento version 2.4.5 Aug 8, 2023 at 7:24

1 Answer 1

1

Could be a permission issue with the .renditions directory.

https://developer.adobe.com/commerce/php/tutorials/backend/modify-image-library-permissions/

"By default, Commerce allows the media gallery access to the following two directories under /pub/media: catalog/category wysiwyg"

Assuming your custom module's structure is under /app/code/Mymodule/Media, here's how you would do it:

Create config.xml: Navigate to the /app/code/Mymodule/Media/etc/ directory.

Add Configuration: Inside the config.xml file, you would add the following XML snippet to extend the "Media Gallery Allowed" folders to '.renditions'

Example config.xml content:

<default>
    <system>
        <media_storage_configuration>
            <allowed_resources>
                <media_gallery_image_folders>
                    <!-- new "Media Gallery Allowed" folders -->
                    <my_image_folder>.renditions</my_image_folder>
                </media_gallery_image_folders>
            </allowed_resources>
        </media_storage_configuration>
    </system>
</default>

<!-- Other existing configuration -->

You'll need to go through the proper steps to make sure your module is properly registered in order for Magento to recognize and use it.

3
  • Hi Xander, this solution did work! Thanks for your help. Aug 14, 2023 at 9:29
  • Glad it worked. I am curious though, directories with a . at the beginning of their name are usually hidden in Unix-like operating systems (e.g., Linux, macOS, and Unix) because they are typically used to store configuration files or other files that are not intended to be visible to the general user. Note, this may be related to Stores>Configuration>Advanced>System>Media Gallery>Enable Old Media Gallery. I've found when 'Old Media Gallery' set to 'Yes' the .renditions directory is not used and no broken image links.
    – Xander
    Aug 15, 2023 at 13:17
  • Stores>Configuration>Advanced>System>Media Gallery>Enable Old Media Gallery>No and set Media Gallery Image Optimization>Enable Image Optimization >No allows you to use the New Media Gallery without broken images going into the /.renditions directory.
    – Xander
    Aug 15, 2023 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.