I have a node with an image field. I cloned the node (using clone.module). Now I have two nodes using the same image. If I delete the image from one node, the file gets deleted, and the other node loses its image.

Comments

auroqn’s picture

Category: bug » feature

Yeah, there should two radio buttons: first for removing file from db only and the second one for removing the file from disk and db.

quicksketch’s picture

The bug here isn't with imagefield deleting the images, which is the correct behavior. Node_clone should be creating a duplicate image for the cloned node, not sharing the same one. The same problem exists for upload module, where the shared files will not be duplicated.

g10’s picture

does the module do a check if the image is still in use by another node before deleting? (and if still in use, then do not remove it)

I think this should be the desired behaviour, as with i18n / translations it is handy to not have to re-upload the images, same file can be shared among different nodes… but not deleted if one of the nodes changes a file
it is better to encapsulate this in the imagefield module, other modules should not be the one to decide whether to duplicate files…

patch for this behaviour is included

g10’s picture

Version: 5.x-1.x-dev » 5.x-2.x-dev
Status: Active » Needs review

(status update)

dopry’s picture

Status: Needs review » Closed (fixed)

sorry Drupal 5 does not support sharing files between nodes. This is a not a feature of imagefield...

The Drupal 6 port will include an implementations of hook_file with reference counting deletes amongst CCK fields, so files will be shareable with imagefield and filefield.