Pages

30 March, 2022

Magento 2 Media Gallery doesn't show any images

The new/more suitable media gallery changed into introduced with the release of Adobe Commerce and Magento Open Source 2.Four.


Enable New Media Gallery

STORES > Settings > Configuration > ADVANCED > System > Media Gallery

Set
Enable Old Media Gallery = No

This will then enable the new media gallery.

Access New Media gallery

CONTENT > Media Gallery

Problem:

Images of old image gallery not showing in the new media gallery (CONTENT > Media Gallery)

Solution:

The Magento doc says that:

Full functionality for new Media Gallery requires media.gallery.synchronization and media.content.synchronization queue consumers to be started for initial synchronization

1) Run the following media sync commands

Synchronize content with assets

bin/magento media-content:sync

Synchronize media storage and media assets in the database

bin/magento media-gallery:sync

Note: If you have a large number of images, then the media-gallery:sync can take some time to complete.

2) Start the following message queue consumers

bin/magento queue:consumers:start media.content.synchronization
bin/magento queue:consumers:start media.gallery.synchronization

If there is a large gallery item to sync, then it might take some time.

In such a case, you can run the commands in the background by appending “&” at the end of the command.

bin/magento queue:consumers:start media.content.synchronization &
bin/magento queue:consumers:start media.gallery.synchronization &

Bonus:

Some references on managing message queues:

List all consumers

bin/magento queue:consumers:list

Start message queue consumers

bin/magento queue:consumers:start [--max-messages=<value>] [--batch-size=<value>] [--single-thread][--area-code=<value>] <consumer_name>

To run message queue in the background, you can append & at the end:

bin/magento queue:consumers:start <consumer_name> &

No comments:

Post a Comment

Thanks