Drupal not generating image style thumbnails and associated directory structure

Created on 16 May 2021, over 3 years ago
Updated 29 November 2023, 12 months ago

In a new install of Drupal 9.1.8 on Debian 10 running PHP 7.3 the media module is not producing image thumbnails or directory structure to hold the image styles. I had this problem on an active site that I upgraded from Drupal 8, but then created a brand new site with the same issue. I have ruled out permission errors by setting all files and folders to 777.

To reproduce: Install a new Drupal 9 site using 'composer drupal/recommended-project', enable media and media library modules, go to /media/add/image and browse to upload an image. Immediately I noticed a blank box where the image should be. After saving the media entity, the image thumbnail is still not showing. Inspecting the folder structure sites/default/files/styles exists, but nothing beyond it and no media style image. The original image was successfully created. Strangely there are no errors in the Drupal log and I could not find related errors in the Apache log file.

Perhaps it is some very specific issue with my setup, but it is pretty standard.

💬 Support request
Status

Closed: works as designed

Version

9.1

Component
Media 

Last updated about 3 hours ago

Created by

🇺🇸United States desierto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India Ajay Gadhavana

    @desierto #5 working for me. Thanks for saving my day

  • 🇺🇸United States crutch

    Experiencing this issue but #5 is not working on windows dev machine using xampp, or LAMP environment on live server. I have to add the remote video (youtube) and save. Delete the video, add the video again and then the thumbnail is generated in both:

    \sites\default\files\oembed_thumbnails\videos
    \sites\default\files\styles\thumbnail\public\oembed_thumbnails\videos

    This happens whether mappings exist or not. Is it a youtube response issue?

  • 🇫🇷France canardesign Montpellier

    Hi ! same problem here, on Drupal 9.5.7
    On production server as well as on Xampp, no images styles are being generated, for any style.
    File system seems ok, other website on Xampp generate style with no problem.
    I know the problem comes from this website configuration or some module breaking the processing of image styles but how to debug this ?
    I tried to dpm() in ImageStyleDownloadController::deliver and ImageStyle::createDerivative with no result.
    Has anybody any idea on how to deal with this ?

  • 🇩🇪Germany carp-enter

    Thanks @desierto and @ahmadhalah
    #5 and #7 save my day.
    Ubuntu and Apache2

  • 🇵🇭Philippines jaesperanza

    In our experience, on Siteground's NGINX hosting, a common issue for Drupal 8/9. For one particular project we inherited, also on SG, we noticed the following is enabled and set to true:

    $config['image.settings']['suppress_itok_output'] = TRUE;
    $config['image.settings']['allow_insecure_derivatives'] = TRUE;

    Disabling both, seems to fix the issue.

  • 🇺🇸United States scottholmes

    Thanks for that headsup on mod rewrite. After spending hours chown, chgrp, and permissions this is what fixed it for me on Drupal 10.1.6

  • Have the same problem on Drupal 10.1.6 at the shared web-hosting with Apache 2.4.58 and PHP 8.1.25. To make custom images styles working and thumbnails visible I have commented option “-ExecCGI” in /public_html/sites/default/files/.htaccess and now it looks like this:

    # Turn off all options we don't need.
    Options -Indexes -Includes -MultiViews
    # -ExecCGI
    

    I am not sure is that the safest solution but it works for me.

  • 🇯🇴Jordan ahmadhalah

    @alfattal would you please share your virtual host configurations?

Production build 0.71.5 2024