image integration with the views module
gordon - June 5, 2006 - 01:19
| Project: | Image |
| Version: | 4.7.x-1.x-dev |
| Component: | image.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | gordon |
| Status: | closed |
Description
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.
| Attachment | Size |
|---|---|
| views_image.inc | 1.93 KB |

#1
The 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.
#2
It 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
#3
Views 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
#4
I create block in Views and it return error:
user warning: Unknown table 'files' in field list query: SELECT node.nid, node.title AS node_title, node.changed AS node_changed, files.filepath FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid WHERE (term_node.tid IN ('17')) LIMIT 0, 1 in D:\work\market\sites\test\includes\database.mysql.inc on line 120.#5
The views_update.inc is now in views so it should work, without any changes.
#6
works 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?
#7
ah 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
#8
This is an awesome patch. Thank you. Is there a way to include image attach in this?
#9
I 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.
#10
Images 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
#11
I 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.
#12
This 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!
#13
Works wonderfully well!
I just created a simple gallery in 2 min. This is *perfect*. Please commit :-)
#14
Here is an example of use for the views integration.
In actual fact I am using the this to develop the complete image gallery.
#15
Well 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.
<!-- begin content --><div class='view view-gallerylist'><table>
<thead><tr><th id="view-field-node_title" class="view-cell-header"></th><th id="view-field-image_nid" class="view-cell-header">Image</th> </tr></thead>
<tbody>
<tr class="odd"><td class="view-field view-field-node_title"><a href="/?q=node/40">k</a></td><td class="view-field view-field-image_nid"></td> </tr>
<tr class="even"><td class="view-field view-field-node_title"><a href="/?q=node/41">jk1</a></td><td class="view-field view-field-image_nid"></td> </tr>
<tr class="odd"><td class="view-field view-field-node_title"><a href="/?q=node/43">jhnk</a></td><td class="view-field view-field-image_nid"></td> </tr>
<tr class="even"><td class="view-field view-field-node_title"><a href="/?q=node/44">Untitled image</a></td><td class="view-field view-field-image_nid"></td> </tr>
<tr class="odd"><td class="view-field view-field-node_title"><a href="/?q=node/45">Untitled image</a></td><td class="view-field view-field-image_nid"></td> </tr>
<tr class="even"><td class="view-field view-field-node_title"><a href="/?q=node/46">Untitled image</a></td><td class="view-field view-field-image_nid"></td> </tr>
<tr class="odd"><td class="view-field view-field-node_title"><a href="/?q=node/47">Untitled image</a></td><td class="view-field view-field-image_nid"></td> </tr>
<tr class="even"><td class="view-field view-field-node_title"><a href="/?q=node/48">Untitled image</a></td><td class="view-field view-field-image_nid"></td> </tr>
<tr class="odd"><td class="view-field view-field-node_title"><a href="/?q=node/49">Untitled image</a></td><td class="view-field view-field-image_nid"></td> </tr>
</tbody></table>
<div id="pager"><span class="pager-list"><strong class="pager-current">1</strong><a href="/?q=gallerylist&page=1" class="pager-last active" title="Go to page 2">2</a></span><a href="/?q=gallerylist&page=1" class="pager-last active" title="Go to next page">next ›</a><a href="/?q=gallerylist&page=1" class="pager-last active" title="Go to last page">last »</a></div></div>
<!-- end content -->
#16
This looks like it is accessing nodes which have no images.
Can you submit your view, so I can take a look.
#17
committed. thanks guys!! :)
#18
does this work with attached images?
#19
no, only with image nodes (node-type: image)
#20
The 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?#21
I 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 9#22
You need to remove the original views_image.inc that I posted.
#23