I'm having a very strange problem with images suddenly displaying at their original size and not as thumbnails. Everything works great but usually within 24 hours, this can happen. This isn't happening with all images or even on all sites running on the same code base. It's a very transient problem and I have no idea what is triggering the images to spontaneously resize themselves. I've tested to see if it happened during a cron job, but it's not. I've even had a few images in the image gallery spontaneously resize while others in the same gallery have not.

I'm surprised no on else is experiencing this. If anyone has ideas what's causing this mystery behavior, I'm all ears.

CommentFileSizeAuthor
#8 image_19.patch642 bytesSteve Dondley

Comments

Zed Pobre’s picture

Component: image.module » image_attach

I know this can happen if the image gallery module loses track of whether a thumbnail file has been generated. If it doesn't think one exists, it will display the original size. I fixed this issue by changing the size of the thumbnails and then immediately changing it back, which seems to have forced them all to regenerate and stay that way... except that this problem has extended throughout my image library (which is quite large) to other sizes as well, so some images aren't displaying at all. I've been trying to force images to regenerate by altering the other values and back and well, but so far the results have been very irregular. Image regeneration seems to be extremely buggy in general, but I'm not sure where to even start looking for the problem.

I wish admins could get a little link on each image page (and each gallery category) that simply says "force regeneration", which would regenerate all of the components on that individual image or images in the gallery.

(Incidentally, the component for this should be image_gallery, but the only component that the preview button seems to think is valid is image_attach. Go figure. I'm not even sure where to submit that as a bug.)

kuahyeow’s picture

hmm, you're not alone.

I just finished a 4.7 website with image_attach, which had the images mysteriously dissappearing on two occasions so far.

All I know is hitting submit on admin/settings/image_attach regenerates them all back again. [haven't had time to investigate further..]

TheFazz’s picture

Component: image_attach » image_gallery

i have a similar problem which occurred when i was making some adjustments to my database tables... prefixing for sharing databases. i have a number of images in my gallery so manually adjusting each is to be avoided as far as possible.

what happens is in the gallery view, some images are displayed in their original sizes - although others are in their thumbnail format. so i get a messy gallery view with overlaps of images.

n4t3’s picture

I've had the same thing happen today. I'm brand new to Drupal but in settings I have the following:
# image
# image_attach
# image_gallery
# img_assist
In the settings for image I had thumbnails set to 150,150 (before uploading anything) and preview set to 640,640. Everything was fine for the about three days of uploading images and assigning images to galleries. Then today I decided to change the thumbnail size to 100,100. This was fine - all the thumbnails generated fine. Then I tried 130,130 and had no problems, then finally 140,140. It was either at this point, or after trying 135,135 that I noticed some images displaying at their original size. I freaked out and couldn't get it to work again properly. I tried re-uploading a backup of all the images in the files/images directory, no difference. Luckily, I had a backup of the database. I blew away the database, created a new one of the same name, uploaded the SQL backup, and all the files in the image directory and everything was working again. Obviously this was a drastic move, and it was only luck that I had a backup. Is there a better way to handle a problem like this? How do I go about re-generating all thumnails manually? I read above that "admin/settings/image_attach regenerates them all back again", but is this a problem in image_attach or image or which?

kuahyeow’s picture

Ah! Sorry, my mistake:

I meant -

admin/settings/image

Then click on the 'save configuration' button, to get all the disappeared images back.

TheFazz’s picture

what happens is in the gallery view, some images are displayed in their original sizes - although others are in their thumbnail format. so i get a messy gallery view with overlaps of images.

my problems is images resizing back to the original size in the gallery / thumbnail views. kuahyeow's problem is different (disappearing?)... and the solution suggested does not work for me.

TheFazz’s picture

I meant -

admin/settings/image

Then click on the 'save configuration' button, to get all the disappeared images back.

I was just wondering whether anybody was working on this. the above suggestion did not work for me.

Steve Dondley’s picture

StatusFileSize
new642 bytes

Here is a patch that fixes the symptom, not the root cause. So it's not a proper patch. This temporary fix simply regenerates the derivative images if it detects the thumbnail is missing.

After looking at the database, I discovered the root cause of the problem is that somehow, the thumbnail and preview entries get deleted out of the {files} table. The entry for the original image remains in tact. The _image_remove() function in the image.module looks like just the code that would do that. It has this line:

db_query("DELETE FROM {files} WHERE nid=%d AND filename!='_original'", $node->nid);

I don't know how or when the _image_remove() function would get called. I suspect there is some weird interaction going on between image_gallery.module and the image.module. Maybe the people who are more familiar with these modules can take it from here.

drewish’s picture

marked http://drupal.org/node/106539 as a duplicate of this.

kuahyeow’s picture

#6(TheFazz) : My mistake again. I misread the description. sorry my problem was dissappearing, therefore not related to this issue.

#8(Steve) : I recently moved webhosts and found that the problem has now cropped up, that is thumbnails being resized to original. Tried your patch, had thumbnails come back on, but sometimes, white pages result instead. So, I removed the patch and now everything's fine.

Could it something to do with moving or the (re)-creation of "file/image" folder?

Steve Dondley’s picture

kuahyeow, interesting. Do you know if your current host is running fastcgi? I run my own servers and run fastcgi on them. I'm not sure why that would cause the problem. I'm just grasping at straws, really.

I have not had problems with the white screen. That's indicative of a memory issue with php. It's probably set too low on your server. I have my memory limit jacked up on my server so that's probably why I'm not seeing it. I could see where resizing a bunch of images at once could put you over the limit.

kuahyeow’s picture

Yup, the new host is running fastcgi, how would that cause it? Anyone?

Yeah, I suppose that white screen is due to the memory limit.

drewish’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev

i've marked http://drupal.org/node/123288 as a duplicate of this

dman’s picture

I'm getting the same (new Drupal 5 install, fresh tarball)
For me it happens any time an image is updated. I add an image . OK. I go back to it and update its details (or just save) and the two generated entries go missing, displaying only the full-size everywhere.

in image_update(), where it checks

  foreach ($node->images as $label => $image) {
    $old_path = db_result(db_query("SELECT filepath FROM {files} WHERE filename='%s' AND nid=%d", $label, $node->nid));

    // This is a new image.
    if ($old_path != $image) {
...

it's always returning null for the DB check - $old_path returns blank - although I saw the row in the database a second ago. So I guess that _image_remove() is the problem.

... on submit, the form is validated via image_form_image_alter();

In that func, if there is no error, and there is no new file, ... all existing info is removed! That seems backwards. It's theoretically supposed to re-gen them each time (waste of time, but whatever) using _image_build_derivatives() ... yet that's not working?
No, they are being built OK, but being trashed during image_update().

... because it thinks the derivatives are the same as the original. As indeed they apparently are when image_update() is being called. That's wrong.
They were OK just after the submit validation...
The paths got reset somewhere between and image_form_image_alter() image_update()
All the derivatives are being set to be the 'original' path. ?! Where and why?

Arrg. This is too hard.

Help!

herb’s picture

I had this problem whenever I edited an image. (Even just changing the title) - and would then get the errors that the "file could not be copied because no file by that name exits error" - with one error message for each size of image file that was being generated.

The image would then subsequently appear in full size.

However, using the "newest" Image 5.x-1.x-dev - As of today, I still get the errors, but the image is updated correctly and no longer ruins my gallery by being displayed at full size. So it seems that progress is being made!

drewish’s picture

marked http://drupal.org/node/121114 as a duplicate

Tim_O’s picture

I applied the patch Steve Dondley posted above (thank you, Steve!), which solves the issue but still leads to error-messages being displayed. Seems this has been around for a while, is where really nobody working on this? Really an annoying problem and it sounds to be a minor thing. I would attempt to look into it for myself, but being a newbie concerning both, PHP and Drupal, I seem to be the last one to effectively deal with this. Anyway, thx to all who bring ahead all these projects!

drewish’s picture

marked http://drupal.org/node/124474 as a duplicate

dman’s picture

Steves patch helps, but still, as noted, shows errors, which is not great.
The patch over here does a better job, but technically is still not a solution IMO.

I've been through the code and it is hairy. I cannot understand what it's attempting to do or why it does so. I don't even understand what the desired patch would look like!
:( I'm sad.

+1 critical!

Steve Dondley’s picture

Version: 5.x-1.x-dev » 4.7.x-1.x-dev

Setting this back to 4.7. That was what I originally filed it under. I think the people who are getting errors with the patch may be on drupal 5.

dman’s picture

OK yes, I thought this was Drupal 5. I patched manually (by sight) so didn't notice :-} . Sorry.

geodaniel’s picture

Status: Active » Needs work

We're seeing this issue too. Just setting the status bits and based on Steve's patch in #8 I think image module looks to be the correct queue for this patch.

geodaniel’s picture

Component: image_gallery » image.module
Chris Johnson’s picture

Since this is broken similarly in the Drupal 5 version, what's the proper way to get that fixed, as well? A separate ticket?

plumbley’s picture

I've uploaded a patch at http://drupal.org/node/68623#comment-277959 which modifies image_display() and image_load() to try to fix this type of problem (and the related "Image sizes skipped if smaller than preview" problem). I've linked it from a few other threads since many of these issues may be connected. I realize a major update to Image 5 has recently taken place, but any feedback on this 4.7 version is appreciated. Mark.

Renee S’s picture

I have this problem in 5.1 (and in 5.2). I'm running the latest version of Image and Image Assist.

Images suddenly appeared at their original sizes instead of thumbnails last night. Regenerating thumbnails resulted in a timeout - it appears that the module keeps regenerating the same file, deleting it, and regenerating it, over and over again, until my PHP timeout is reached.

drewish’s picture

z allen, this issue is for 4.7. if read through it you'll find links to a 5.x issue which fixed this. upgrade to the 5.x-1.4 release. if you're still having the same problem open a new issue.

sun’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Needs work » Fixed

Development and support for 4.7.x and 4.6.x has ended. You are strongly advised to upgrade to Drupal 5.x or 6.x.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.