This may be possible already, but I am guessing no, so I've labeled it a feature request:

It would be great to be able to use the pixel dimensions of an image in Views (as a filter, argument, sort criteria, and field to display).

This would be an incredibly useful feature, for example, you could:

  • Filter out images that are too small from your display
  • Show only images in a particular orientation (vertical, horizontal, or square)
  • Allow user to click-sort by size
  • Display the dimensions of an image as a field

I am happy to lend my meager php skills to help implement this feature, but I'm curious what people (developers) think would be the best way to go about it. I can think of two options:

  1. Create 3 new CCK fields for the image nodetype: height, width, and orientation. Do not display them on the node/edit or image/upload page. Teach the image uploader how to fill in these fields automatically (orientation is redundant information if you know the height & width, I know, but it would greatly simplify administering the view, since those kinds of mathematical comparisons are not easy to do in views). Done. Because they are CCK fields, they are automatically available to Views.
  2. Another (better?) approach would be to store that info in the database directly (maybe it is already? I haven't looked) and create a views handler to provide the appropriate filters, arguments, fields, etc. This could eliminate the need for the redundant "orientation" field in the db, because the views handler could do the math and provide the results to views.

Please let me know what approach you would recommend, and any advice you would have for doing it. Thanks.

Comments

dddave’s picture

Status: Active » Closed (won't fix)

NG3 is where the magic happens now and it makes use of imagechache.