I think there is problem in webhosting. Partial solution is mentioned in this thread Unable to create thumbnail image, but for me is impossible recompile PHP on my webhosting. I have found another (and this might be final) solution. I discover problem in function image_scale() in DRUPAL includes/image.inc - if paths $source is equal with path $destination there is no problem with resize image (in user profile module i have no problem with upload and resize new user image). If these paths are not equal i get always error like:
* warning: imagejpeg(): Unable to access files/obrazky/temp/rozhovor2.thumbnail.jpg in /data/web/webspace/02/27/00/0500002702/kope-vas-muza/includes/image.inc on line 300.
* warning: imagejpeg(): Invalid filename 'files/obrazky/temp/rozhovor2.thumbnail.jpg' in /data/web/webspace/02/27/00/0500002702/kope-vas-muza/includes/image.inc on line 300.
* Unable to create thumbnail image
I give idea use touch() PHP function for create new (empty) file before is image resized. I have rewrite image_scale() function from
function image_scale($source, $destination, $width, $height) {
$info = image_get_info($source);
...
to
function image_scale($source, $destination, $width, $height) {
// in some web hosting there is problem with create file with new filename through
// image_scale function. If file exists then is new image (with name $destination)
// created without problem
if (!file_exists($destination)) touch($destination);
$info = image_get_info($source);
...
and now thumbnail and preview images are created without problem in my webhosting .
Comments
Comment #1
havran commentedSorry i forget some important info - i use DRUPAL 4.7rc3 and latest Image module from cvs. Excuse me...
Comment #2
Jep commentedA better way to correct this bug is changing the image_gd_close function :
Comment #3
havran commentedI see. Later I need use function image_resize() and i have same problem with create thumbnail. This is much better way. Thanks.
Comment #4
jochenh commentedI am using the following setup: drupal 4.7, gd2 working fine, image module. Directory permissions are set to 777 for the following dirs: files, images, temp. Drupal file handling is set to private.
When I try to create an image i get this:
and of course nothing shows up in the gallery.
Please advise.
I even tried to run this with a 'corrected' image_gd_close function as described here: http://drupal.org/node/60155
but still no luck
Please advise
thanks!
- Jochen
Comment #5
jochenh commentedsorry, i am closing this because it was actually a problem with my hosting. looks like they recompiled apache without GD or something...
Comment #6
L. Allen Poole commentedI'm having a similar, presumably related problem with line 284 of image.inc:
http://drupal.org/node/73986
If anyone resolves this issue, and if the solution appears relevant to 4.6, please let me know?
Thanks,
Allen