Integrate image_attach with Views

David Lesieur - September 26, 2006 - 04:36
Project:Image
Version:4.7.x-1.x-dev
Component:image_attach
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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.

AttachmentSize
image_attach.module.patch2.37 KB

#1

dodazzi - October 12, 2006 - 23:31

great!
I will test this ASAP

#2

gordon - November 9, 2006 - 22:17

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.

AttachmentSize
image.diff.txt 6 KB

#3

gordon - November 9, 2006 - 22:21

hadn't stripped out the image_alter() stuff.

AttachmentSize
image.diff_0.txt 1.15 KB

#4

David Lesieur - November 10, 2006 - 05:52

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.

#5

dodazzi - November 22, 2006 - 00:32

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?

#6

gordon - November 22, 2006 - 05:28

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.

#7

David Lesieur - November 23, 2006 - 20:28

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.

#8

kuahyeow - November 29, 2006 - 04:59

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

#9

David Lesieur - December 20, 2006 - 04:38
Status:needs review» reviewed & tested by the community

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

#10

kuahyeow - December 20, 2006 - 06:15

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.

#11

nedjo - January 13, 2007 - 00:51

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.

#12

walkah - January 13, 2007 - 06:20
Status:reviewed & tested by the community» fixed

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

#13

Anonymous - January 27, 2007 - 06:30
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.