OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums OroCommerce My product images are not displayed in the frontend

This topic contains 7 replies, has 2 voices, and was last updated by  Mauro Chojrin 5 days, 22 hours ago.

  • Creator
    Topic
  • #41243

    Mauro Chojrin
    Participant

    Hi:

    I’m experiencing a similar situation as https://forum.oroinc.com/orocommerce/topic/problem-displays-images-in-frontend/

    Something I noticed is that the original “src” attribute for a given image is, for instance, /admin/media/cache/attachment/resize/product_large/f8ad5f04db8a20c593bca34d27fd6799/212/5d8abc6197260989555596.jpg?version=67ea5915

    Looking in my public directory I can’t see an admin directory but there is a similar file located at public/media/cache/admin/media/cache/attachment/resize/product_large/f8ad5f04db8a20c593bca34d27fd6799/212/5d8abc6197260989555596.jpg

    If I manually change the img src (straight in the browser) to something like /media/cache/attachment/resize/product_large/f8ad5f04db8a20c593bca34d27fd6799/212/5d8abc6197260989555596.jpg?version=67ea5915

    the images are displayed just fine…

    I tried creating a symlink to public/media/cache/admin as public/admin but that didn’t work.

    I just upgraded to OroCommerce 3.1.17 and I hadn’t noticed this issue before.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #41244
    Michael
    Michael
    Keymaster

    Hi Mauro,

    Please check the “ACL Protected” option of the “image” field of the “Product Image” entity. It should normally be set to “No”.

    Attachments:
    1. Screenshot-from-2020-01-10-11-00-39-128x72
    #41246

    Mauro Chojrin
    Participant

    Hi Michael:

    Thanks for your answer… I’m affraid that doesn’t seem to be the problem… ACL Protected option is already set to “No” :(

    #41247

    Mauro Chojrin
    Participant

    Something strange just happened… now I seem to be able to see the images… perhaps the image resizing was taking longer than I expected…

    I’ll mark the issue as resolved for the time being and keep an eye on it… thanks!

    #41248

    Mauro Chojrin
    Participant

    Apparently I was to eager to solve the issue :(

    Just checked the website and the images are broken again… Not only the product images but the categories as well.

    I did the same test as before and found that if I remove the /admin prefix from the img src it works, but I don’t know why such prefix is added to the images.

    Thanks for the help!

    #41253

    Mauro Chojrin
    Participant

    Hi:

    I’ve been digging into the code and found that there are two routes that could be used to generate image URLs such the ones I’m looking at:

    • oro_filtered_attachment
    • oro_frontend_attachment_filter_image

    For some reason I still can’t figure out my frontend (in production) seems to be using the first when it should use the second (as in my VM).

    I checked the Oro version in both and it’s the same (3.1.17)… so, since the code is the same, I believe the issue must be a difference in the contents of the database, right?

    #41260

    Mauro Chojrin
    Participant

    Ok… so I kind of solved the issue, though I’m not entirely satisfied (since I don’t know why it manifested in the first place…).

    Digging into the code I found this:

    And a little below:

    In my particular case, oro_frontend.guest_access_enabled was not enabled (It never was actually)… when I did enable it my images appeared… in fact, when I unchecked it in the VM I got to reproduce the error…

    I can’t tell for sure but I believe this is a bug that was introduced either in 3.1.16 or 3.1.17 (Up to 3.1.15 I hadn’t had any such trouble).

    The file where I think the problem might be located is vendor/oro/customer-portal/src/Oro/Bundle/FrontendAttachmentBundle/Provider/FileUrlProvider.php

    In fact, if I comment out the lines 159-161 I get the expected behavior (Images shown when I’m logged in as a non-admin user and login required to browse the catalogue).

    #41261

    Mauro Chojrin
    Participant

    So again it seems I was to eager to close the issue, hehe…

    With the change I mentioned above I got to see the images displayed ok in the home page, the product page and the category images in the product list page but, for some reason I still can’t see the product images in the list page…

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No