Comments

imkatie1’s picture

Thank you so much! It works!!!!!!!!!!!!!!!

merlinofchaos’s picture

A quick note: Make sure image_attach.module does not include image_attach.views.inc on its own -- Views will include this.

imkatie1’s picture

I used this patch yesterday and it perfectly worked.

But when I make a view showing node title and attached image,
the view shows only the nodes which have an attached image.

So if a node doesn't have an attached image, the node doesn't show up in the view!

At first time I thought it might be a problem of views2.
But no, for other fields such as attached file using upload module this doesn't happen.
for any other fields in views it's ok....

It is a problem only when I use attached image as a field in views2.

I don't no why... help please~~~~~

R.Muilwijk’s picture

@hyunkatie, at the moment the view is using a INNER join. This means it requires the image to exists in the image_attach table. Change the 'INNER' type to 'LEFT' to fix it.

I'll check merlinofchaos his feedback tomorrow and provide a new patch.

merlinofchaos’s picture

2 solutions:

1) just change the join to LEFT and leave it that way
2) change to using a relationship which will have a checkbox.

I'm not sure 2 is optimal here, honestly.

R.Muilwijk’s picture

StatusFileSize
new5.37 KB

Since image attach can't be configured whether or not it is required I changed the join to a 'LEFT'. It ain't included anywhere:

grep --exclude=.svn -R image.views.inc *
image.views.inc:// $Id: image.views.inc,v 1.1 2008/06/16 18:06:01 drewish Exp $

Patch attached with 'LEFT' join.

imkatie1’s picture

@R.Muilwijk

Thank you so much!!!!!!!!

drewish’s picture

Status: Needs review » Needs work

i couldn't get that patch to apply. looks like the first line with the $id$ might be to blame.

mrfelton’s picture

subscribing:- I'd like to know when this patch gets committed.

R.Muilwijk’s picture

StatusFileSize
new5.43 KB

New working patch is up

R.Muilwijk’s picture

Status: Needs work » Needs review
matias.quaglia’s picture

It works smoothly to me...
Thanks a lot!

merlinofchaos’s picture

I have some really really minor comments.

+++ contrib/image_attach/image_attach.views.inc

For me it is always easiest to apply patches if they are generated from a cvs checkout in the base module directory. That way it's always just a matter of patch -p0 < file.patch -- this is very minor, though.

+ 'type' => 'LEFT',

LEFT is the default and does not need to be explicit. (There is nothing wrong with being explicit, however).

+ $data['image_attach']['table']['group'] = t('Image Attach');

+ 'title' => t('Attached Image'), // The item it appears as on the UI,

Drupal standard for capitalization is now that we capitalize the first word only. So: t('Image attach') and t('Attached image'); -- doing this will create better visual consistency with other Views handlers.

+class image_attach_views_handler_field_iid extends views_handler_field {

It would be polite to comment the class.

Probably the most important thing:
This class seems to be missing the option_definition() function which supplies default settings and informs Views how to export the settings.

R.Muilwijk’s picture

@merlinofchaos, thanks for the review. It's the first thing I made for views 2 so it's nice to hear what you are doing right and wrong. I'll fix the stuff next couple of days and dive into the option_definition part. The reason I don't run patch from CVS is because I quite dislike CVS. Have custom shortcuts for drupal head but not for contrib.

drewish’s picture

Status: Needs review » Needs work

if you can re-roll with fixes for the things merlin pointed out i'll get this committed quickly.

deviantintegral’s picture

Status: Needs work » Needs review
StatusFileSize
new5.89 KB

Here is a patch with all of the changes Merlin suggested. I also noticed that no Help was specified for the field, which I've added.

--Andrew

drewish’s picture

Status: Needs review » Fixed

Thanks committed to HEAD.

gama10’s picture

Hi,

I had the same problem with views2 and Image 6.x1.x.alpha3 than discribed at http://drupal.org/node/220295
I copied the patch from this page, which solved the problem - (I got the image attach field) but:

Thumbnails and images are not displayed in view!

Does someone has an idea, whats wrong?

Thanks for your help!

geraldito’s picture

279844_image_attach_views2_2.patch worked smooth and provided a funcitonal image attach field to views module 6.x-2.0-rc1. but after upgrading to version 6.x-2.0-rc2 images disapeared and views module shows an error in Fields definitions. Default: "Error: handler for image_attach > iid doesn't exist!" Page: "Broken/missing handler: Imagen"

aruns4’s picture

where and how am i to use this patch..

pls say me..

Doomd’s picture

I am trying to add attached images to a view...but they are nary to be found in this release. Doh well.

schlotterich’s picture

i got the same problem as geraldito after the new version of views I can't finde the image attach field in views anymore

EmpireNM’s picture

Version: 6.x-1.x-dev » 6.x-1.0-alpha3
Status: Fixed » Active

I have applied the patch as well, but still don't see any image options in the latest version of Views.

matslats’s picture

I can't see the attached image appearing as a node field exposed to views either

Hetta’s picture

Status: Active » Closed (duplicate)
geshan’s picture

Dunno why the patch is not working with my installation :-(.

prbass’s picture

Status: Closed (duplicate) » Needs review
StatusFileSize
new6.12 KB

Re-rolled patch against 6.x-dev for the new Views API, as described at http://drupal.org/node/220295 #45

With the briefest of testing, it seems to work okay with the new Views 2.0

asmo75’s picture

i have problem

$ patch -p0 < image_attach_279844.patch
patching file contrib/image_attach/image_attach.views.inc
Hunk #1 FAILED at 35.
1 out of 1 hunk FAILED -- saving rejects to file contrib/image_attach/image_a
ch.views.inc.rej
patching file contrib/image_attach/image_attach.module
patching file .project
patching file contrib/image_attach/image_attach_views_handler_field_iid.inc

drewish’s picture

Status: Needs review » Fixed

thanks, committed to HEAD. please report any further bugs as new issues.

-enzo-’s picture

Hello drewish

I get the same message error asmo75 reported, I download the patch file from http://drupal.org/files/issues/image_attach_279844.patch.

Could you provide a link to get a patch with this error fixed please

Best regards

enzo

drewish’s picture

-enzo- once a patch has been committed a new -dev release is created within 12 hours so at this point you can just use the -dev release.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

rayray’s picture

I have installed the dev version and tested this out. It works, which is nice. I'm using PHP 5 and MySQL 5, and the problem I'm having is performance.

It takes about 15 seconds to render a page showing the 10 newest "recipes" along with their thumbnails! Without the image connection, it takes about 1/4 of a second. So I'm going to have to look at how my database is arranged, but I think this patch might need a bit of work with regards to its performance!

markstos’s picture

Title: Image attach views 2 » Image attach views 2 (How I got it to work)
Version: 6.x-1.0-alpha3 » 6.x-1.x-dev

I got this to work by installing the "6.x-1-x" dev version from here:

http://drupal.org/project/image

Then, when editing a View, I could click on the option to add a few field, and new group of options, "Image Attach" appeared, and it contains the attached image field option. After selecting, the image started appearing in the view!

Mark