Question

Newly uploaded images are not appearing on the Magento Front End when using Database as the media storage mechanism, in Magento CE 2.3.

I have tried almost everything, including cache clean, flush, resize images command.

One issue I've noticed is that the catalog:images:resize script returns an error complaining that File 'xyz.png' does not exist., which is correct, it does not exist - not on the filesystem at least, it's stored in the database (and I can see it in the database with the same directory).

Magento permissions are all fine. Hoping for some tips if anyone can help!

Était-ce utile?

La solution

The reason you couldn't find your media images on the storeFront is Magento system couldn't transfer your media image file from the database to the file system. Yes though you saved your media file in the database , when the browser requests for the media file, Magento will fetch the binary file in the database and transfer it to the file system apparently to return it back to the browser. As your file is not in the file system which magento expects it doesnt show up and no surprise catalog:images:resize command failed eventually.

To be precise,there's a file under yourmagentoroot/pub/get.php which is the PHP script responsible to transfer the files from the database to the file system to fulfill browser media request. The possible reason that it couldn't be was it might not be triggered at all because of another rewrite configuration setting

So just set your debug break points in your editor for get.php and confirm whether it's triggered.

Besides these, also make sure you enabled mod-rewrite in your webserver (apache/nginx) and the file permissions are set right.

Before that get yourself acquainted with How Magento stores the media in the database and how it renders from their official 2.x (2.3) docs.

Hope am pointing you to the right direction.

System locates media in database. A PHP script transfers the files from the database to the file system, and sent to the customer’s browser. The browser request for media triggers the script to run as follows:

If web server rewrites are enabled for Magento and supported by the server, the PHP script runs only when the requested media is not found in the file system. If web server rewrites are disabled for Magento, or not supported by the server, the PHP script runs anyway, even if the required media is available in the file system.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top