Hello, my public file system path is set to:

sites/all/themes/aurum/aurum_sub/files

But when I upload images that use image styles, the link to them is incorrect when viewing the page. What happens is that the images are uploaded to the public path above, not to (as an example):

sites/all/themes/aurum/aurum_sub/files/styles/blog_773x276/public

even though that path is created by image styles. The files and folders have proper permissions (755). Any ideas? TIA!

Comments

VM’s picture

image styles location isn't set based on the file system path as it's not an image being uploaded but generated after upload. Not sure why one would want to store the images in the theme folder. If there is any setting for it it would be in the config for image styles which I think is pretty limited.

digibrill’s picture

Yes, I meant that the files are just being generated into the root file system path.

You're right about the config being limited. Oh, why do you not recommend the images in the theme folder? If they are to do with that theme isn't it proper?
Thanks so much!

digibrill tic

VM’s picture

if they are to do with the the theme my question would become why are you handling in drupal as content?

As it currently stands you are directing the software to store every file uploaded into any content will now be saved to the theme folder.

digibrill’s picture

Thanks! I will have to fix that.

Do you have any idea why the image styles are generating files into the file system root?

digibrill tic

VM’s picture

OTTOMH no. Does the same occur when the file system is returned to its default?

digibrill’s picture

I've set the file path back to sites/default/files, but the issue has not changed, i.e. when I upload images that use image styles, the link to them is incorrect when viewing the page. The images are uploaded to the public path above, not to sites/default/files/styles/blog_773x276/public even though that path is created by image styles.

digibrill tic

VM’s picture

and you are sure the image in the default files folder is an image style and isn't the original image?

if yes, where is the original image being stored?

I don't see where Drupal would ignore creating the image style folders and storing the image there unless it isn't able to write to the folder. If this is the case you would have warnings/notices in your drupal logs. Is anything relevant being printed to the drupal logs?

digibrill’s picture

Oh that is so basic! I didn't consider checking that, but yes the image in the files dir is in fact the regular image. And the Recent log messages show this:

Type access denied
Date Wednesday, August 31, 2016 - 22:03
User Admin
Location https://www.mysite.com/sites/default/files/styles/blog_773x276/public/Te...
Referrer https://www.mysite.com/blog/12-dolorem-eum-fugiat-quo-voluptas
Message sites/default/files/styles/blog_773x276/public/Test Blog Header Image.jpg
Severity warning
Hostname 172.20.0.212
Operations

But checking all the permissions on all parts of that path shows at least 755. We did recently change the site(s) to https. Would that change anything?

digibrill tic

VM’s picture

I'd test 775 and 777 if necessary to debug.

https: Anything is possible. Disable and test.

I'd also ensure I visit the node. I don't remember if D7 generated the image style at upload or at the time of 1st node display.

digibrill’s picture

Well I have set everything in that path to 777 and visited the node-still not able to generate to those dirs. Here is the .htaccess from the files dir. Could be something in here? (Removed comments)

Options None
Options +FollowSymLinks

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006

<Files *>

  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003

</Files>

<IfModule mod_php5.c>

  php_flag engine off

</IfModule>

digibrill tic

VM’s picture

can be easily tested by commenting out the lines

digibrill’s picture

Still getting access denied in recent log messages. I've checked all dir permission and htaccess files.

digibrill tic

VM’s picture

let's back up a bit.

files folder is set to 777 and none of the image style folders are being generated? not even the first folder? 'styles' ?

digibrill’s picture

no. Just uploads the original image to files dir and displays error in reports.

digibrill tic

digibrill’s picture

Solved! It was missing support for JPEGs in the GD library. I was able to upload/generate PNGs and GIFs, but not JPEGs. Thanks for the help and your time!

digibrill tic