3

This question already has an answer here:

Image styles are not being applied. I have the /files/ directory set to CHMOD 777, GD Library is installed. When you upload an image, it just goes to the /files/ directory, none of the styles are generated into their styles folder. Reports -> status report is clean. Image uploads, but it stays in files directory, no thumbnails are generated, all paths are broken to the image even to the thumbnail in the Media page.

Hosted on AWS EC2 Linux/Apache

.htaccess in /files dir:

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# 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>

marked as duplicate by kiamlaluno Mar 5 '17 at 13:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    You might not have necessary rights for the folders inside /files/, in this case /files/styles. Try chmod 775 -R </path/to/files_dir> – OPTASY Dec 9 '16 at 17:08
  • I used chmod -R 777 on the entire folder, Drupal is also not complaining about permissions in the Status Report... – keeg Dec 9 '16 at 17:18
  • It can be a problem with .htaccess file in sites/default/files directory, it depends on your host provider – Andrew Nim Dec 9 '16 at 20:04
  • I'll add additional info – keeg Dec 9 '16 at 20:05
  • confirm if 777 permission of 'sites/default/files' are recursive and cross verify permissions of 'sites/default/files/styles' directory, because image styles are stored inside this directory. Also check Drupal Logs to check failure of image style generation. Also please provide Drupal version you're using. – Yogesh Dec 22 '16 at 6:35
1
+50

It's because you do not have the correct folder owner/group.

You need to cd into your /sites folder. Once there:

If you're using Ubuntu do:

sudo chown www-data:www-data -R default

For CentOS it's:

sudo chown apache:apache -R default and disable SELinux


PS: Never give your files folders permission of 777, set it to 775

  • 1
    @googletorp but wont solve the problem of course not, that's why it's a PS – No Sssweat Dec 22 '16 at 8:46
  • 1
    @googletorp perhaps you meant to place your comment on the other answer? – No Sssweat Dec 22 '16 at 8:52
  • 1
    @keeg, since you accepted my answer by clicking on the ✅, I take it you got it to work? – No Sssweat Dec 23 '16 at 0:55
  • 1
    Yes there was another setting along with the permissions fixed it – keeg Dec 23 '16 at 0:56
  • 1
    For those in the same boat, make sure that "Default download method" is set to "Private local files served by Drupal" in Configuration -> Media -> File System if using locally stored images – keeg Dec 23 '16 at 2:14
0
  • Firstly, provide 775 permission to files folder. chmod 775 -rf sites/default/files/

  • Custom image styles(created by you) are stored in files/styles directory. To have an image style, create it from /admin/config/media/image-styles.

  • If you are searching for the images you uploaded, they are placed in the directory mentioned in field storage structure which you can see from manage field of a content type under File Directory. Ex- /admin/structure/types/manage/article/fields/node.article.field_image. By Default, [date:custom:Y]-[date:custom:m] is set in "File Directory".

Hope, it makes sense to you. Sorry, for 777 it's 775

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