Posted by Heilong on June 3, 2009 at 6:59am
14 followers
| Project: | FileField |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Hi everyone,
I have Imagefield which allow my user to upload at most 5 images to complete the node, I also enabled default image to display something in case of the user doesn't have any image to upload.
I also have a formatted view of the content and now I tried to let users filter by images, to let the view display all nodes with images or without images (default image).
Is it possible to realize this ?
Comments
#1
#2
Hm, this isn't a use-case I'd though of. There currently isn't a "has file" filter, because you can accomplish the same thing with a relationship. However there isn't a way to expose such a setting to show only nodes that don't have files. This was marked won't fix in several issues I believe. See #317784: filter by imagefield with views 6.x? for some brief instructions on setting up a relationship to do this.
So I'll mark this as a feature request since it's a valid request to have this as a filter so that you can expose it.
#3
Yes, I saw that post on how to set up a relationship.
But it wasn't what I needed, actually for this feature it could be something like a filter which show the user "with pictures" or "without pictures" to test if the default Imagefield Image is present.
#4
+1
I am unable to accomplish this with a relationship on the file table, as even though there are filters like file id, file size, file status etc. none of them can show me nodes that even if they have imagefield no files were uploaded...
I tried playing around with filters like File ID but it is just a text field, which expects the id. Also setting the File Size filter to IS NULL does not show nodes without imagefiles uploaded.
There was this #554292: Filefield filter in view : can't get "is null" operator but it seems the original purpose got lost somewhere along the way. :)
#5
Per #950000: Views Sort Criteria "image uploaded: YES/NO", this should also include the functionality to sort in addition to filter.
#6
Hi, I'm coming from #950000. It would be great to be able to add sort criteria as well. This would allow nodes with pictures to be sorted to the top of the views query (aka in my case users with content profiles with pictures are higher up the search). I hope this may be added to the module in the near future to allow maximum flexibility in its usage.
Many thanks!
#7
I should note that you can basically already sort by sorting on the File: FID column, though you'll still end up with NULL records at the bottom I believe. It'll also end up with newer user pictures showing up at the top, but perhaps that's also okay. This new approach would likely just be a short-cut and a more balanced approach.
#8
I needed to present content with images at the top, while randomly sorting once the content without images was pushed to the bottom. I used a relationship for the field, then used File: Status as a sort criteria. This allowed me to still use Global: Random.
#9
What relationship do you add to the field? Seems like a long workaround and might conflict with other sorts?
Also it doesn't solve the filter to only show "has file" nodes. Changing setting back to active to remain as a feature request.
Please let me know if this should remain as fixed. Thank you!
#10
You add the fields relationship to the view, then sort using file: status. Also it does solve the issue with "has file" filtering as you can "require this relationship" and that will only show nodes which have a file.
#11
What about only showing nodes without a file?
#12
This issue should remain open. We need a dedicated filter to:
A) Show nodes that don't have a file uploaded.
B) Expose the filter to the end-user.
#13
Coming from #372241: Make a "has file" Views Filter. This is an essential feature for a few of my views, and it would be so nice to have a built-in filter for it.
#14
I was lucky someone pointed me to the solution. At least it solved the sorting problem, not the exposure. http://drupal.org/node/981710#comment-3812512
#15
subscribing
#16
Trying to sort by FID, as suggested previously, didn't work for me. I was able to get it to work with file status though.
#17
Here's a patch which allows an exposed filter for whether there is a file present or not.
#18
Super, thanks @joachim! I still run into this problem all the time.
#19
I patched #17 but can't find out how it works. After patching it now I have a new filter for "fid" with the option of "true" and "false".Even if I set it "false" it displays the nodes that have files... How can I get it work?
I'm using it for file field of content profile type node.
#20
http://drupal.org/node/1438712 some solutions without patch.
#21
@#19: That's weird. I've just checked on the site where I'm running this patch and it works perfectly for me.
I have: latest Drupal core, latest fieldfield, and latest Views 2.x. Are on Views 3.x by any chance?
#22
@joachim I use Drupal 6.22 Views 6.x-3.0-rc2 Filfile 6.x-3.10 That might be because of the Views virsion.. I now use the solution mentioned in #20 by @DeepM and it works for me.