Indexhibit
Index + Exhibit

Login:

Created by
Daniel Eatock
Jeffery Vaska
And You

Sorting images alphanumerically?

 

Indexhibit version: 2.0
Thread is not resolved.

michoho
CANADA
1 year(s) ago
Permalink Post

Is there any way of doing this?

Whenever I upload images, they upload according to their upload speed and I have to drag and reorder all the images myself. This isn't a problem if there are only 10-20 images, but when I upload any more than that per exhibit, it becomes such a hassle to reorder.

Would there be any way to implement some sort of php code so I can have it sort ascending/descending according to alphanumerics?

Vaska A
UNITED STATES
1 year(s) ago
Permalink Post

It's on the list of things to look at. But, ordering them alphanumerically is pretty custom...we'll be looking to try to order them the way they are uploaded.

You could always edit the exhibit format to rewrite/reorder the images array.

michoho
CANADA
1 year(s) ago
Permalink Post

Thanks for the quick reply.

I'm currently looking at /plugin/format.visual_index.php to see where it may be possible to do a reorder, but since I'm pretty new to this, it's hard to figure out.

Vaska A
UNITED STATES
1 year(s) ago
Permalink Post

So as not to mess with the defaults, do the following...

- duplicated /ndxzsite/plugin/format.visual_index.php
- put it in your $theme folder (probably default)
- edit the file as you wish (it overrides the default now)

You can loop and rewrite the images array as you see fit. This is not something for beginners to mess with, I'll add, unless you have patience and wish to learn something about code.

michoho
CANADA
1 year(s) ago
Permalink Post

Is there anyway you can direct me to where the images array is located? I've looked over the php a few times but I'm having trouble spotting it due to the # of variables in the code.

Vaska A
UNITED STATES
1 year(s) ago
Permalink Post

It is messy, but it has alot of features...

The images come from this function (in nearly all formats):

  1. $OBJ->page->get_imgs();

The array you want is:

  1. $this->imgs

The array has additional arrays so you will need to access it this way...

  1. foreach ($this->imgs as $arr1)
  2. {
  3.   foreach ($arr1 as $arr2)
  4.   {
  5.     // do your transformations here...like...
  6.     $new_arr[$arr2['media_file']] = $arr2;
  7.   }
  8. }

And this will get your rolling...there is more to be done but I'll let you learn some things...

michoho
CANADA
1 year(s) ago
Permalink Post

I've been trying the whole week to get it to sort, but I guess I'm not good in coding haha.

Vaska A
UNITED STATES
1 year(s) ago
Permalink Post

That's how I learned how to code.

Showing 1 - 8 of 8 posts in Forum » Customize » Sorting images alphanumerically?
 

This thread has been closed, thank you.