Description

I'm running a drupal site version 4.6.3 with php 5.0.5 on Ubuntu 5.10. using clean url's.

Periodically I the following error shows system/files not found in the admin section and it's always a thumbnail or a picture that's suddenly missing. In about 90% of the cases when the thumbnail has vanished the picture itself is also missing. It happens to pictures in galleries and to pictures embeded in posts (using img_assist).

I can duplicate one cause of the problem. When I edit the picture by entering a description or a small story from a pc NOT in my own local network I get the following errors:

* Cannot create thumbnail
* Cannot create preview

In this case either all pictures are gone or the picture itself is used as thumbnail

The other cause for the vanishing pictures is a mystery to me. Every now and then pictures just disappear from the files/images folder and the system starts getting a lot of system/files not found errors. Most of the time the affected pictures are those for which I have entered a description and changed the tiltle.

This unpredictable behaviour of the image module makes it in fact useless since I cannot depend on it for showing my pictures.

any ideas on how to fix this!

ThePhoenix!

Comments

bwynants’s picture

Noticed the same problems

see also
http://drupal.org/node/25465
http://drupal.org/node/39189

have no senario however

elmuerte’s picture

Had the same problem and I solved it. The reason is because of unsafe string comparing.

To fix it change the following code to look like this

function image_update($node) {
  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 (strcmp($old_path, $image) != 0) { //NOTE: the offending line
      file_delete(file_create_path($old_path));
      db_query("DELETE FROM {files} WHERE filename='%s' AND nid=%d", $label, $node->nid);
      _image_insert($node->nid, $label, file_create_path($image));
    }
  }
}

"//NOTE: the offending line" is the line that creates the error

--
http://www.magicball.net

walkah’s picture

This issue should be fixed in the latest version. Thanks.

James Walker :: Bryght Guy

--
James Walker :: http://walkah.net/

Phoenix77’s picture

Thanks Walkah!

Downloaded the new Image module (and I apologise I did verify if the fix mentioned by elmuerte was present), but Drupal still mentions the wrong version number.

Could you tell us what else has been changed in version 5.6.0?

Thanx allot!! and keep up the great work.

The Phoenix
http://vliestroompje.homeip.net [in Dutch]

Ian Ward’s picture

Hey Walkah,
Does upgrading to version 1.146.2.12 require deleting the image files from the files directory and cleaning up the files table in the DB?

Cheers,
Ian

rjung’s picture

Just wanted to ping the question above -- does incorporating this fix require a total purge (of the /images directory and the {files} table) and re-import of all your images? Seems rather drastic...

--R.J.
http://www.electric-escape.net/

--R.J.

Ian Ward’s picture

Just pinging on this again. The reason I ask is because I thought i fixed it on a site by re-uploading all the images, and it worked for a few weeks, but then, I clicked to allow for users to download the original image in admin/settings/image and i think doing that made the same problem reoccur - all thumbnails were lost, according to drupal. but now, looking in the file system, it looks like all the images i reuploaded were named w/a prefix like "HPIM..." and I dont have anything by HP, and the images did not have generic or system names when I uploaded them, so it looks like they got converted during the upload.

Ian

Phoenix77’s picture

Thanx, I knew that the answer was out there :)

I'm gonna try right away and re-upload my images.

The Phoenix
http://vliestroompje.homeip.net [in Dutch]

Phoenix77’s picture

not only that, the speed of my site has increased quite alot!

Great work!

The Phoenix
http://vliestroompje.homeip.net [in Dutch]