Here is a piece of code which will allow users to add images to tables of list views.
Required the upload include which is here.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | snapper1156138568692.png | 267.66 KB | gordon |
| #11 | image_views.patch_0.txt | 2.1 KB | gordon |
| #10 | image_views.patch.txt | 2.94 KB | gordon |
| #7 | views_image_0.inc | 1.96 KB | fago |
| views_image.inc | 1.93 KB | gordon |
Comments
Comment #1
gordon commentedThe dependancy of #67262 as now been commited, so you only need to put this into views/modules to test.
When it is commited I recommend that this code is included within the image module.
Comment #2
mboes commentedIt doesn't do anything for me. Aren't Image: fields supposed to appear in the list of possible fields?
I have upload and image modules enabled, and copied the attached file to views/modules/.
Mathieu
Comment #3
gordon commentedViews does a lot of caching, so once you have copied this into views/modules and cleared the cache you will then see that new image fields
Comment #4
vatavale commentedI create block in Views and it return error:
Comment #5
gordon commentedThe views_update.inc is now in views so it should work, without any changes.
Comment #6
fagoworks fine, however one has to enable the upload module, so that views includes the views_upload.inc. that shouldn't be so... perhaps views should include content of views_upload.inc always as this stuff belongs to file.inc?
further shouldn't be this a patch against image module? or will views ship with definitions for contrib modules too?
Comment #7
fagoah I forgot, there was a little problem with the display of images as link. (wrong paramters for l(), $html needs to be true..).
I've attached a corrected file
Comment #8
jake28 commentedThis is an awesome patch. Thank you. Is there a way to include image attach in this?
Comment #9
jake28 commentedI think I can be clearer, actually. Okay, in views the image content type must be selected for this to work. But what about story, or blog content types? When they have images attached?
It would be wonderful to have this work for any content type, even cck. Thank you again for the contribution.
Comment #10
gordon commentedImages that are linked to blogs or other node types are not linked via the database, but by a img tag in the content.
This only works on image nodes.
Here is an intergrated patch for the image module that included this functionality directly into image. This will work with 4.7 but links will not work on HEAD bcause of http://drupal.org/node/78399
Comment #11
gordon commentedI have made some changes, and I have managed to add in an option on the display field you can select the size that you want to display.
The good thing about this is that if your parameters for image sizes have been changed it will create the new size on the fly, and it has made the filter redundent, so the patch is smaller.
It also no longer requires the views upload integration.
Comment #12
webchickThis looks ready to me. I created a couple views with this and works as expected. The ability to select between showing a previews, thumbnail, and original size image and image/link to image is a very nice touch!
Comment #13
m3avrck commentedWorks wonderfully well!
I just created a simple gallery in 2 min. This is *perfect*. Please commit :-)
Comment #14
gordon commentedHere is an example of use for the views integration.
In actual fact I am using the this to develop the complete image gallery.
Comment #15
natan-1 commentedWell I think i installed the patch correctly as i now have an Image: Display Image choice on the Add Field menu. So I tried setting up a test view with all images I have uploaded. First I selected a table view and then selected the "Image: Display Image" and "Node : Title" fields to display. Then for my filter I picked "Node:Type" and selected images. My list only provides me with the titles and no images show up this is my pertinant source code it I took off the rendered view page.
Comment #16
gordon commentedThis looks like it is accessing nodes which have no images.
Can you submit your view, so I can take a look.
Comment #17
walkah commentedcommitted. thanks guys!! :)
Comment #18
dodorama commenteddoes this work with attached images?
Comment #19
Tobias Maier commentedno, only with image nodes (node-type: image)
Comment #20
mo6The patch redefines
function image_views_tables(). Somehow my php5 installation doesn't like that and Drupal returns a blank page. I have to comment out the same function in the image.module to make it work. Am I missing something? Anyone else tested this contribution with php5?Comment #21
schwa commentedI installed in views/modules and upon refresh, site returned:
Fatal error: Cannot redeclare image_views_tables() (previously declared in /home/apache/htdocs/xxxx/modules/image/image.module:341) in /home/apache/htdocs/xxxx/modules/contrib/views/modules/views_image.inc on line 9Comment #22
gordon commentedYou need to remove the original views_image.inc that I posted.
Comment #23
(not verified) commented