I am having problems with drupal losing track of where an image's thumbail file is located upon editing a previously uploaded and thumbnailed image. I am using the 4.6.0 release image module, but I still see the problem after installing today's cvs image module. If I want to edit an image's description, I have to re-upload the original image file, and then I have two sitting in my images directory, which is a waste of disk space. Is anyone else seeing this? If I don't re-upload the image when I edit the description, drupal displays the full image where the thumbnail should have been, which makes the page unreadable. Any pointers on this would be appreciated. Thanks!

Comments

ejahn’s picture

What it really gets down to, I'm finding, is that the preview _0_0.jpg file isn't getting generated for the "latest image" block. When I edit the file, the "latest image" block doesn't find its preview and just shows the full-size one in the block.

dtan’s picture

Hi ejahn,

Any update on this? I couldn't reproduce in 4.6. Have you tried the most recent 4.6 tag in cvs and let me know if the problem persists. Also some more detail of the files created/exist in the directories before and after your editing.

dtan’s picture

Apparently the cvs image module + drupal 4.6 doesn't go so well. http://drupal.org/node/24854

Jose Reyero’s picture

I couldn't reproduce it either (4.6.2 + image 4.6).

And yes, it seems that the cvs version of the module is suppossed to work only with Drupal-HEAD

merlinofchaos’s picture

I seem to have this problem using Drupal 4.2 and the 4.6.0 version of the image module.

Whenever an image is edited, I get an error that it couldn't generate the thumbnail; now, it shouldn't need to regenerate the thumbnail since I didn't upload a new image, so my guess is that it's not noticing that the image field is blank and that there are already attachments there representing the image. After this, all images are lost from the node.

merlinofchaos’s picture

Err. Pardon me. I mean 4.6.2, not 4.2

merlinofchaos’s picture

An additional piece of information: After some investigation, this only seems to happen if a 'preview' image doesn't exist; right now most of the images in my gallery have only a thumbnail and an _original. I'm not sure why there isn't a preview. Most things work if there isn't a preview.

I'm not sure 1) why they don't have a preview or 2) how to make a node without a preview. Uploading an image now creates all 3. I am confused.

aries’s picture

I confirm that what merlinofchaos wrote. Upgrade from 4.5.2 to 4.6.2 is buggy on my sites. It's a problem with the stable (4.6) branch not only with CVS.

rjung’s picture

Title: Editing a previously uploaded and thumnailed image loses the thumbnail. » Any progress?

Does anyone know if progress has been made with this bug? I got bitten by it several times this weekend, and was hoping to find a patch on Drupal.org... :-(

--R.J.

rjung’s picture

Title: Any progress? » Editing a previously uploaded and thumnailed image loses the thumbnail.

Sorry for changing the title, changing it back now.

--R.J.

thekenshow’s picture

The image module is very much broken for me as well. Using Drupal 4.6.2 and the 4.6 image module, every time I update an image (that was working previously) the thumbnail reflects the change but the node view image link breaks. No preview operation is involved.

Below is the files table content after an update, where alex_transfiguration.jpg was the original and tiger250.jpg the replacement. At this point, the files/images directory contains tiger250.jpg, tiger250.thumbnail.jpg and no alex_transformation images. The node view contains a broken image link because it points to files/images/alex_transfiguration.jpg, which no longer exists.

fid: 11
nid: 4
filename: preview
filepath: images/alex_transfiguration.jpg
filemime: image/jpeg
filesize: 114712
list: 0

fid: 12
nid: 4
filename: thumbnail
filepath: images/tiger250.thumbnail.jpg
filemime: image/jpeg
filesize: 2910
list: 0

fid: 13
nid: 4
filename: _original
filepath: images/tiger250.jpg
filemime: image/jpeg
filesize: 11011
list: 0

Note that reloading the original image leaves the node view broken, as the link continues to point to alex_transfiguration.jpg however the files/images directory contains alex_transfiguration.jpg.

rjung’s picture

Not sure if this will help, but while looking through the image.module code this morning, I saw that image_update() calls _image_insert() to update images from the form.

Some thoughts:

1. Is it possible the disappearing preview bug occurs (partially) because image_update() mistakenly thinks an image has been updated when it hasn't?

2. _image_insert() does not appear to have any sort of error handling/reporting if it fails -- such as if file_copy() does not work for some reason. Might this cause problems in image_update() as a result?

3. Could this problem be related to the open_basedir bug documented in http://drupal.org/node/5961? Particularly, items #9 and #10 may be causing this.

Perhaps someone with more free time than I have can investigate the matter...?

poonlap’s picture

I have the same problem too with Drupal 4.6.2 and image module 4.6.0. It is strange that sometimes it happened sometime it didn't. Here is one of how to reproduce the problem.

- Upload an image
- Go to Administrator -> Settings -> image
- Change the thumbnail size
- Save changes
- Edit the description of uploaded image
- Click Submit button and get "Unable to create thumbnail image"
- When I go to directory files/images, that image was gone.

I notice that after I uploaded that image, I can edit description without any problem. But after some period (may relate with cron job), I edited the description and got that error.

poonlap’s picture

From my observation, the message "Unable to create thumbnail image" is from function _image_build_derivatives. The function _image_build_derivatives was called by function image_display without second argument ($temp which I don't know what is it for). The result is function _image_build_derivatives call _image_remove($node), then thumbnail and original image were deleted. I think this is the problem.

So I changed the line "_image_build_derivatives($node)" in function image_display to "_image_build_derivatives($node, true)", then I don't get the error "Unable to create thumbmail image" again. At least for my case, it works fine. Please confirm.

rjung’s picture

Priority: Critical » Normal

To follow up on poonlap's suggestion -- I have implemented the fix on my site, and so far it seems to be working. Since I have not been able to recreate the original bug at will, it's primarily a case of "cross my fingers and hope the issue is vanquished forever." ;-) So far, so good...

Actually, my variation of poonlap's fix is to go into _image_build_derivatives() and comment out the if-then block that actually calls _image_remove--

// Comment out to implement poonlap's fix
/*
if (!$temp) { 	 
  _image_remove($node); 	 
}
*/

While browsing the CVS repository for image.module, I noted that this block of code was introduced in version 1.146.2.5 (diff here), as an apparent backport of a bug fix for derivative re-generation after settings changes. I'm not sure what are the repercussions of disabling this code, though.

--R.J.

alexmc’s picture

I'm trying to use the comic module which itself uses image.module and I am not getting *any* thumbnails or previews generated. It is frustrating as I cannot see why! The GD module is now installed, and I think the file/directory permissions are correct. Gah!

bwynants’s picture

Version: » 4.6.x-1.x-dev
Priority: Normal » Critical

Same issue here, poonlap's fix of adding true to _image_build_derivatives in image_display does seem to fix it!

Seems like the same problem is still in CVS

bwynants’s picture

does not fix it. it's even worst all previews and thumbnails are created in the temp directory inside the image directory and this temp directory is whiped out very 6 hours.

I have set all invocations of _image_build_derivatives (in image_validate and in image_display) to call it with true, not false. That seems better....

bwynants’s picture

Status: Active » Needs review
walkah’s picture

Status: Needs review » Closed (duplicate)

dupe of #41238

merlinofchaos’s picture

Umm. This is a dup of a forum post? That seems wrong to me. Doesn't it about guarantee that this bug is never fixed?