When a user adds an image to the node (image thumb is generated using imagefiled_thumbs preset), but he _doesn't_ save the changes (just leaves the node form), then the related entry in {files} table is left with status 0. That means, that after some time this entry will be removed from the table in a cron run (system_cron() in system.module) and also the file will be deleted from the file system.

But since system_cron() implementation uses file_delete() function from includes/file.inc to delete the files, then only the original file is actually being deleted and thumbnail image is left untouched! Because of that if another user uploads an image with the very same name, then a wrong thumbnail (the old one) will be displayed to him (new and correct one won't be created).

The solution is to delete also the thumbnail in such situations.

Comments

aitala’s picture

I am also seeing this where the thumb is not removed from the sites/default/files/imagefield_thumbs base directory BUT a copy is moved into the subdirectory for the content type, like default/files/imagefield_thumbs/reviews/space-1999 where reviews is the content type and space-1999 is the node's alias.

Eric