Images are not rendered if a path is set - token not correctly handled (Multisite install)
| Project: | ImageField |
| Version: | 6.x-3.0 |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I am using ImageField together with Upload Path.
I have a multisite configuration.
The file directories permissions are 775
I made 3 test: without path, with tokenized path and with hard coded path - only the first test is successful
1) no PATH (but the Upload Path is active)
Images are correctly uploaded and displayed
- Thumbnail link in edit mode:
http://www. mysite.fr/sites/mysite.fr/files/picture.jpg
- Image link in view mode:
http://www. mysite.fr/sites/mysite.fr/files/picture.jpg?1246317843
- Image Location
/www/sites/reihaneh.fr/files/picture.jpg
- Thumbnail location
/www/sites/reihaneh.fr/files/imagefield_thumbs/picture.jpg
2) Path using Token "nodes/[type]"
The content type for the test is "tod"
- broken thumbnail ilink in edit mode:
http://www.mysite.fr/sites/mysite.fr/files/imagefield_thumbs/nodes/type/...
Note: Uses "type" which is the token name instead of its value "tod"
- Broken image in view mode:
http://www. mysite.fr/sites/mysite.fr/files/nodes/tod/picture.jpg?1246318162
- The following directories were created:
/www/sites/reihaneh.fr/files/nodes
/www/sites/reihaneh.fr/files/nodes/tod
/www/sites/reihaneh.fr/files/nodes/type
Note: the last one shouln't exist - it is the token name
/www/sites/reihaneh.fr/files/imagefield_thumbs/nodes
/www/sites/reihaneh.fr/files/imagefield_thumbs/nodes/tod
/www/sites/reihaneh.fr/files/imagefield_thumbs/nodes/type
Note: same as above
- Image file Location :
/www/sites/reihaneh.fr/files/nodes/tod/picture.jpg
- Thumbnail file location:
MISSING
3) Path without token
The path is set to dir1/dir2
- Broken thumbnail in edit mode
http://www.reihaneh.fr/sites/reihaneh.fr/files/imagefield_thumbs/dir1/di...
- Broken image :
http://www.reihaneh.fr/sites/reihaneh.fr/files/dir1/dir2/picture.jpg?124...
- Image file Location :
/www/sites/reihaneh.fr/files/dir1/dir2/picture.jpg
- Thumbnail file location:
/www/sites/reihaneh.fr/files/imagefield_thumbs/dir1/dir2/picture.jpg
There is a serious bug here, I hope this will help solving it.

#1
Regarding the use of node-based tokens (such as [type]), any issues should be reported to the FileField Paths queue, which is responsible for moving files around as needed for node-tokens. However the non-node-token path "dir1/dir2" should work fine with ImageField normally, even in a multisite installation.
According to your report a file exists at:
/www/sites/reihaneh.fr/files/dir1/dir2/picture.jpg
But then is missing when viewed at:
http://www.reihaneh.fr/sites/reihaneh.fr/files/dir1/dir2/picture.jpg
That seems like a conflicting report, since if the file exists in the right place on disk it should be accessible via the web address also. Try disabling the FileField Paths module and if the problem is corrected for non-node-based paths then we can move it to the appropriate queue.
#2
I tried again uploading an image in the dr1/dir2 path.
I then disabled the FileField Path module.
Still the same: the image and thumbnails appear broken, the files are correctly stored
The broken image link is
http://www.reihaneh.fr/sites/reihaneh.fr/files/dir1/dir2/picture.jpg?124...
The ftp location is:
/www/sites/reihaneh.fr/files/dir1/dir22/picture.jpg
What should be the permissions of the files directory, its subdirectories and contained file?
I find the following:
www: 755
sites: 755
reihaneh.fr: 555
file : 775
dir1: 744
dir2: 744
picture.jpg : 664
I'll submitt the token issue to the FileField Path
Thanks for taking care
#3
If the file is being uploaded to the correct place but you're just not able to access it through the web, there's probably a server configuration error. From what you're describing you wouldn't be able to access an image even if you uploaded it through FTP. The permissions that you mentioned sound fine, but it'll depend on who is the owner/group for each of the directories.
Unfortunately I'm not able to tell why you're not able to access files that have been uploaded through the web, but if that is the case it's not a problem caused by FileField/ImageField specifically and there's no changes to the code that can fix this problem.
#4
Could you please tell me more about this owner/group of each directories?
Apache user is nobody/nobody
Each specific site directory has its individual owner.
Can this be a problem?
Thank you for your help
#5
jvieille, I'm not sure what's incorrect about your server set up. While permissions are a frequent culprit, it doesn't sound like the problem on your site since Drupal is able to save the file just fine, you just can't view it, which is unusual. I've heard of problems with the .htaccess file in the files directory causing problems before (see #431310: Server 500 Error prevents images from displaying), but I'm really not sure what's wrong here.
#6
I read the post, my situation is different, may be simpler
Everything work perfectly as long as I don't use paths - files in the /files/ directory behave normally
The problem is then I use paths: the newy created folders get the permission 744, which in my case prevents the files to be accessed
If I change the permissions manually to 775, it works.
For sure it has nothing to do with ImageField as the I have same problem with files uploaded with the core Upload module. They can be accessed only if no path is set.
I have 3 web sites running on the same Drupal install, I seem to have the problem with other sites as well of course.
thank you for your help and time
#7