This patch allows to display attached images in Views. It can show an attached image as a simple img, or in a link to the attached image, or in a link to the node that attaches the image. Thumbnail, preview and original sizes are also supported.

Comments

dodorama’s picture

great!
I will test this ASAP

gordon’s picture

StatusFileSize
new6 KB

Taking a look at this, I think that having a separate views interface for the image_attach module is not the best.

Having a single views interface for the image module would be much better.

Here is a patch which adds into the image module views interface the ability to read handle images which have been attached to a node.

gordon’s picture

StatusFileSize
new1.15 KB

hadn't stripped out the image_alter() stuff.

David Lesieur’s picture

This is an interesting approach, and I like reducing the amount of code. ;-) However, I see some serious drawbacks to it:

  • You are creating a kind of dependency in image towards image_attach (not a strong one, but still, "iid" is really image_attach specific).
  • You lose the ability for the image to display as a link to the node that attaches it. This is important, because with image_attach the attached image is often not the main object of interest - the node that attaches the image is usually what we are interested in. Say, we show a thumbnail in a view, we usually want it to link to the node that attaches it, not the node of the thumbnail. If it was the images we were interested in, we would filter the view for image nodes, not for nodes with attached images.
  • Eventually we'll need special Views hooks for image_attach anyways, for example to get the ability of filtering for "nodes that have/do not have an attached image". My patch did not implement that filter, but was just one step away.
dodorama’s picture

I just tested the first patch (by David) and works flawlessy for me. I don't think it's a problem to have a separate interface for attached images since, infact, they're two different modules at the moment.
Can we mark this ready to be committed?

gordon’s picture

The reason that I though adding them together means that you can create your view, and include both image nodes, and nodes with images attached in the same list.

Where as you cannot do this with having the views code in the image attach module, as you have 2 fields for a view and need to use some custom theming to get them into 1.

David Lesieur’s picture

Yes, your use case is a valid one. However, my gut feeling is that it may not be the most sought after. So I suggest that we commit the original patch. ;-)

In fact, one patch does not really precludes the other, as they neither have exactly the same purpose nor do they affect the same modules.

kuahyeow’s picture

Just what I needed. I will test it out, and let you know the results.

David Lesieur’s picture

Status: Needs review » Reviewed & tested by the community

Tested and ready to be committed, i.e. the original image_attach.module.patch. ;-)

kuahyeow’s picture

I have tested the original patch, just for displaying attached images and it works without problems. As I have no use for the second patch, i did not test that.

nedjo’s picture

Yes, these are separate patches addressing related but distinct issues. The first is the one described in the issue title: that image_attach should expose its table to views. gordon's patch could go into a follow-up issue. It would require more discussion and review.

+1 to the first patch.

walkah’s picture

Status: Reviewed & tested by the community » Fixed

committed David's patch. Thanks for the patch and the reviews! :)

Anonymous’s picture

Status: Fixed » Closed (fixed)