On each run of cron or when uploading an image I get warnings like this one:
realpath() [function.realpath]: Unable to access /home/html/DOMAIN/public_html/images/temp in file /home/html/jazda-na-f1.sk/public_html/includes/file.inc on line 182.
The reason seems to be that the cron hook (image.module, line 136) and _image_filename function (line 828) pass to file_create_path the content of the variable image_default_path, which is supposed to be a subdirectory of the files directory. Function file_create_path tries first to check whether the path is contained either within the files directory or within the temporary directory, only at the end it tries to prefix the path with the files directory location.
The path passed to file_create_path should be prefixed in both occurences with the files directory location to avoid unnecessary lookups and warnings for example like in _image_check_settings():
$image_path = file_create_path(file_directory_path() .'/'. variable_get('image_default_path', 'images'));
$temp_path = rtrim($image_path, '/') .'/temp';
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | image-HEAD.image-file-paths.patch | 3.51 KB | sun |
| #3 | image-225024-3.patch | 921 bytes | hitka |
Comments
Comment #1
hitka commentedNot attaching a patch, solution offered in the issue body (I hope that's enough).
Comment #2
Hetta commentedNope, I can't test your solution, cos I keep getting errors with what you've suggested. Please roll a patch.
Comment #3
hitka commentedAttaching a patch against image module release "Image 6.x-1.x-dev (2008-Mar-03)". Nothing fancy, just prefix the image default path with
file_directory_path() .'/'.before passing tofile_create_path.Comment #4
hitka commentedForgot to update the status.
BTW in the issue 209090 the problem actually the same, but unfortunately not all occurrences of
variable_get('image_default_path', 'images')passed tofile_create_pathwere fixed to be prefixed withfile_directory_path() .'/'.Comment #5
sunThis looks very very valid.
Comment #6
corbacho commentedSame problem here with Image 6.x-1.0-alpha4
I don't have this problem in local installation with Windows XAMPP but when I put it on the server starts Linux to appear this errors. Why? Anyway, I have tested a fresh installation on the server. Details:
Drupal 6.9 installed in root of domain with only Image module.
Default directory in file system: sites/default/files
Installed only the module images, with the default directory "images"
By the way, I create the folder "temp" via FTP manually to avoid some problems of SAFE MODE with the installation of the module.
When I create an attachment of a file of a image (by drupal core), nothing happens.
When I create an node image, I upload a photo and that is done correctly but a lot of warnings "unable to access" appears, like the title of this issue says "unnecesary".
8 messages like these ones:
Comment #7
corbacho commentedHi again,
I have the same problem also in uploading user pictures (in their profiles). It works, but it displays that "unnecesary" warnings.
I don't know how to create a patch, but change this line
$destination = variable_get('user_picture_path', 'pictures') .'/picture-'. $form['#uid'] .'.'. $info['extension'];by this one
$destination = file_directory_path() .'/'. variable_get('user_picture_path', 'pictures') .'/picture-'. $form['#uid'] .'.'. $info['extension'];in the file user.module
That should work.
I don't know then if this issue is due of Image module or has to do with this other issue http://drupal.org/node/155781 ?
Comment #8
sunComment #9
sunCommitted to 6.x and 5.x-2.x.