13.11.2025 | Pascal Crott

Fix broken media previews

media-install.sh
drush php-eval "\Drupal::moduleHandler()->loadInclude('media', 'install');media_install();";

Issue:

The error log is full of the warning "Warning: copy(public://media-icons/generic/generic.png)" and the media library shows no previews. This can happen when environments are set up based on a database dump and without properly transferring the files. The media icons are usually created during the installation of the media module, which will never happen in this scenario.

Devbit broken media preview icons

Solution:

Trigger the install hook of the Core Media module. It will take care of creating those files. Use the provided snippet.

See also https://www.drupal.org/project/drupal/issues/3060509

Weitere DevBits

01.09.2026 | Michael Ebert

Show the status report with Drush in your terminal

drush_core_requirements.sh
drush core:requirements