Has anyone been successful in sorting images by their filename in the gallery? This is helpful for those of us who leave our filenames the way they come out of the camera (or rename them as a datestamp), and would like to maintain chronological order:

_MG_5009.JPG
_MG_5010.JPG
etc.

Comments

kenjiru’s picture

I would also love to have some control over the sorting order of the images in galleries.

joachim’s picture

For that, we'd need an extra sort criterion in Views.
Shouldn't be too hard, as "file name" already exists as a Views field.

tj2653’s picture

I can't seem to find a "file name" field in Views. Am I blind or do I need to install something to see it? :)

drewish’s picture

joachim's comments really were relevant to the 2.x branch. though i'm not sure the image filename is a field there...

joachim’s picture

In the 2.x branch, there's Image: File name, file path, file size and a few other things. Just as fields though, not sort criteria.

drewish’s picture

ah, right you are, i'd forgotten that i'd moved that over.

tj2653’s picture

Hi,

I tried using the "Image: File name" field, but it's only displaying the text "thumbnail" or "_original" for all images. Any ideas? Other fields such as "Image: File path" work properly.

Thanks

marcoBauli’s picture

Status: Active » Postponed (maintainer needs more info)

tj2653: joachim talked about the "Image:File Name" in the Fields options, but what we want here is a different sorting order, not displaying a field.

You need to pick "Node: Title" in the Filters options instead (of course previously override the default Image gallery view by enabling and editing it, i suppose you already did this).

Please mark this as fixed if it does the job (chances are good ;)

tj2653’s picture

Hi Marco,

I know title defaults to the filenames, but I use actual readable titles in my setup, so that wouldn't work, would it?

Thanks

joachim’s picture

This added to $tables['image_files'] works, but you'll need to wait for the fix to http://drupal.org/node/219939 for it work properly:

    'sorts' => array(
      'filepath' => array(
        'name' => t('Image: File name'),
        'help' => t('Sort by the file name of the image.'),
      ),    
    ),
sun’s picture

Category: support » feature
Status: Postponed (maintainer needs more info) » Active

Please provide a proper patch.

sun’s picture

Status: Active » Closed (won't fix)

5.x-1.x won't receive any new features. Please upgrade.