0

I am using Drupal 8.7.5 and PHP 7.3.7 running on Apache 2.4.6.

UPDATE: I'm trying to make available a library of images to the public. I chose the content type of 'Directory listing' to do this. In the Directory listing I have configured a private file path (i.e. located outside of Web root) to hold the images. Apparently I have done something right as it is working except for the thumbnails. I get constant 404 errors in my apache logs and the other errors through the web interface seen in the images below.

What have I missed in terms of getting the thumbnails working? Am I missing an binary or library to render the thumbnails? Did I not create or configure a path for the thumbnails?

Below are some of the steps I have done to configure the Directory listing.

UPDATE On the server I have installed Druapl 8 using composer and drush to $APACHE_CONTENT/drupal. The drush site-install then goes to $APACHE_CONTENT/drupal/web (drupal app_root) and have added a 'private' path as $APACHE_CONTENT/resources. This puts the 'private' path outside of the drupal site's DocumentRoot. The permissions and ownership for the 'private' path are 775 and apache.apache. Also, a .htaccess file was auto generated for the 'private' path. It contains the following:

# cat .htaccess
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
  Deny from all
</IfModule>

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

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

In drupal/sites/default/settings.php I have:

$settings['file_private_path'] = $app_root . '/../../resources';

Viewing the Configuration->Media->File system is see:

enter image description here

I've configured a private file path to use with content created via Content->Add Content->Directory listing.

enter image description here

I have then used scp to copy files into the private path.

Through the web interface, I can browse through the content but I never see the thumbnails. I get errors above my content.

enter image description here

In the apache logs I see 404s for the thumbnails:

GET /system/files/styles/thumbnail/private/Images/JPG/Marshal_Hub.jpg?itok=QwQds55m HTTP/1.1" 404 11730

I have GD installed.

enter image description here

While I can browse all of the content in the 'private' paths, none of the thumbnails get generated.

What do I need to do to get the thumbnails working?

  • Welcome to Drupal Answers :) What are you trying to do exactly? Making formerly public images private? Did you check private folder permission and ownership? Please edit your question for clarification. Many thanks – leymannx Jul 30 at 7:56
  • I have edited my original post but essentially I'm seeing a lot of 404 errors in my apache logs regarding the missing thumbnails for images I'm serving from a private file path for the Directory listing content type. The errors are like this: GET /system/files/styles/thumbnail/private/Images/JPG/Marshal_Hub.jpg?itok=QwQds55m HTTP/1.1" 404 11730. For a private file path, where do I create this path for the thumbnails? – Tom Robinson Jul 30 at 23:23
  • I added a sub path to my 'private' path: 'files/styles/thumbnail/private/Images/JPG'. Now I get HTTP 403s: "GET /system/files/styles/thumbnail/private/Images/JPG/Marshal_Hub.jpg?itok=dcxRfIFy HTTP/1.1" 403 22711 Seems like it's the correct path but I'm just hacking things to see what works...still not working... – Tom Robinson Jul 31 at 6:43
  • Did you update your Directory listings contents after copying the public folder to private? Or try adding a new content? If not, my guess would be that the path you gave in your settings.php is not the right one (hence the 404 errors because Drupal cannot create the thumbnails) and the images you are currently viewing are still the public ones. Also when going to yoursite.com/admin/config/media/file-system, are you able to see your private folder path? – misterdidi Jul 31 at 7:51
  • This is a fresh install of D8 done with composer and drush. I had no content in public. I set up private from scratch. So, no, I did not copy or update Directory listings. I get 404s only on HTTP GETs for thumbnails. All my content is listed and I can browse it through the web front end. Thumbnails fail to render and are 404. I manually added my best guess at a thumbnail path for the private path but it still fails to render thumbnails. I have uploaded new content but the thumbnail error persists in the Apache logs. Yes, I can see my private folder path @mysite/admin/config/media/file-sysyem – Tom Robinson Jul 31 at 14:27
0

This is a workaround I used to solve the issue:

[https://www.drupal.org/project/private_files_download_permission]

I don't consider this 'magic' to be a fix. There is a lack of documentation and/or a bug in the filebrowser module.

How can one raise an issue with the developers?

PS: Also, now have another issue with the filebrowser module: sort order is not being honoured in Grid view!

-1

It's my understanding that the 'private' directory can not be used to serve files. The whole point of this special directory is to provide a protected place for the files you choose to place in there. If the images are place in another directory under the 'sites/*/files' directory they should be accessible to be served.

  • Thanks. But I already can serve the files from 'private'. I just don't get thumbnails. So the issue is not that I can't serve the files. The issue is that for the files I'm serving, no thumbnails are generated. My understanding was that a 'private' directory is one to which you can't browse directly because it is outside of the web root. Also, 'private' paths can have access restrictions applied. See: [drupal.org/docs/8/core/modules/file/overview] – Tom Robinson Jul 31 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.