I've used image attach on several sites now, and every time it limitations bug me and start me wondering what we can do to make this feature better.

Here's a shopping list:
- attach more than one image (there's a patch elsewhere, so let's not worry about this here)
- limit the pool of attachable images, say by taxonomy
- give control over who can attach what. For example: can you attach only your own images or can you attach any image in the pool?
- a better widget for selecting images existing, such as a filmstrip of thumbnails with something to filter above it.
- the option to have more inline fields for inline adding of new images, such as taxonomy or body.
- the option to enforce referential integrity: don't allow an image to be deleted if it's attached elsewhere, or at least warn the user, or possibly only let the user delete an image if they have edit rights to all the attaching nodes.
- the option for backlinks, ie attached images list the nodes they are attached to.

The thing is, once I see that list, I think: why limit this to image attaching? Everything here apart from the filmstrip is totally generic. I might need story nodes attaching to project nodes, for instance, and there's already one clone of this module in the audio package.

So the question is: can CCK nodereference be beefed up to do all this, or does this need to be a whole new module?

Comments

sun’s picture

joachim’s picture

What we need to replicate image_attach with CCK:

- CCK noderef
- something nice to browse for images -- can be a CCK field widget
- something nice to format images -- can be a CCK field formatter. For fancier stuff use http://drupal.org/project/nodereference_views
- something to allow inline uploading of new images (and automatically create a new node). There's a chain of modules that do this starting here: http://drupal.org/project/addnode and there are two more linked from there. And http://drupal.org/project/noderefcreate too. No idea if they're any good, or if they have an API that would let us specify the image field must be included. See http://groups.drupal.org/node/25144 for a wiki page I've started on this.
- better permissions in CCK noderef. For example, it's a reasonable use case that a user should only be allowed to reference things they own. This is not currently in image attach but it would be nice to have.

Upgrade path:
This is fairly simple I reckon:
- add a noderef field on each content type that attaches images
- work through the image_attach table, working out from the nid which field is affected, and then loading that node, setting the value for that field, then saving it.

AaronBauman’s picture

Image Attach Browse

Should have a stable release out soon...
Just sayin'

joachim’s picture

Looks great, and when image attach converts to being a nodereference wrapper I'm sure Image Attach Browse can be converted too -- or maybe merge in for 7? One to consider!

Scott J’s picture

"when image attach converts to being a nodereference wrapper"

Oooooooo Joachim, stop teasing! Please start a 6.x-3.x-dev or whatever it will be called asap. Give us some hope!

joachim’s picture

I would like to get a 1.0 release out of the door first! And the lack of patch testing going on in this issue queue doesn't inspire me at all to start churning out code on a new branch. If people help test patches for 1.0 then I can dedicate the time I spend on image module to development beyond it.

Also, I'm leaning more towards a conversion at the D7 stage, because everything nodereference-ish will dramatically change for D7.

Scott J’s picture

Thanks for that Joachim.

I guess that 1.x just works for me, so I don't know what to test!

I can understand why you would be leaning to D7, so that you only have to worry about converting once; fair enough. Maybe it is too late for D6, but for me, I think it will be a long time before I think about D7.

joachim’s picture

> I guess that 1.x just works for me, so I don't know what to test!

Patches in the issue queue -- look at the queue, filter on 'needs review'.

Scott J’s picture

I found another widget for CCK nodereference fields, Nodereference Image Helper to attach image nodes. I've added it to your wiki.

joachim’s picture

Are you sure that's image-compatible? The project page suggests it's CCK/Imagecache.

It does look very interesting though as a building block for a CCK-based image attach. Thanks for bringing it to my attention.

Scott J’s picture

No, no, not for image module. See, I used a small i meaning generic 'image' content type with imagefield, not capital I for 'Image Module' nodes ;-)

Depends on: Content, Node Reference, ImageField, ImageCache, Text, Option Widgets, FileField, and ImageAPI. You may choose your content type, imagecache pre-set, and view.

I'm trying it out just now, so i'll report back later.

joachim’s picture

I think it's best if the Image module docs mention only modules that actually work with Image module's content type and ecosystem.

asb’s picture

uberEllis’s picture

*subscribe*

sun’s picture

Status: Active » Closed (duplicate)