Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Thumbnail sorting and linked files  (Read 6564 times)

0 Members and 1 Guest are viewing this topic.

amiyuy

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 9
    • K.Y.O. Cosplay gallery
Thumbnail sorting and linked files
« on: June 16, 2006, 11:08:17 am »

Okay, I'm in love with keywords and the Position Descending sorting option.

However, after implementing the sorting gallery-wide today I discovered a few frustrating things.

After changing the "Default sort order for files" in the "Thumbnail view" settings to "Position Descending":
1) In order for it to apply to an album I had to go into the "Sort my pictures" and apply it to the album, whether or not I moved anything.
2) After applying it to certain galleries that house images that are linked in other galleries, I discovered that they then were thrown sporadically into the other galleries and then messing up the order of the images in there.

Here, with pictures to explain:
What I want:
(http://i5.photobucket.com/albums/y160/amiyuy01/other/thumbnailorder-want.jpg)
This is the way it looked before I did the "Apply Modifications" to the gallery that "PJ friends" is in.

What I have:
(http://i5.photobucket.com/albums/y160/amiyuy01/other/thumbnailorder-have.jpg)
This album has 3 pictures directly in it and I sorted them to have "Heero pose," "Smile," and "Decals" as the first three images.  "PJ friends" is linked from another Album.

However, when I did the "Apply Modifications" to the gallery that "PJ friends" is in it threw that image into the middle of the other images in this gallery.  This is the easiest way to show it, but it happened with MANY of our albums and has thrown off a lot of the ordering that we had just fixed.  Since I can't change the order of the linked images within that album, they're stuck there in the middle of the ones that I CAN change the order of.

After searching the forums for help I found this thread: http://forum.coppermine-gallery.net/index.php?topic=20704.0

However, I saw no update to it and it didn't address the problem with linked files, so I'm here asking for help to see if there is anything that I can do to fix this.

I need to be able to:
- Get linked images to show up at the end of the galleries instead of in the middle of the other images
And a bonus would be to:
- Change the way some albums are sorting thumbnails independently from the default setting of the gallery

EDIT: This album is showing exactly what I want.  I have done the "Apply modifications" to that album (Naruto) but have not to the album of the linked images that are displaying at the bottom ("Gaara, Hinata, Sakura, and Sasuke," "Magazine Page 6," and "Sakura and Sasuke") so the linked images are still displaying at the end of the main album.
« Last Edit: June 16, 2006, 11:34:01 am by amiyuy »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Thumbnail sorting and linked files
« Reply #1 on: June 16, 2006, 10:39:05 pm »

Here's my guess, which I think is correct.  First of all, you need to understand how the "position" is set for files in an album.  There's a "position" field for each file, and there's a "home album" for each file as well.  So when you go in and set the custom sort order for an album, it creates a series of numbers for each file, in the order you set; e.g. 101,102,103,..., 120 for 20 files in album A.  Those numbers are saved as the "position" for that file.  Now say that a file with a position of 105 is linked into another album.  When that album is displayed, all the files are pulled in, with each corresponding "position".  So the linked file with a position of 105 will show up in the order of files between 104 and 106, next to a file that also has a position of 105 (if such a file exists).  Thus, the linked files will always show up in the middle somewhere, unless the position is larger than any other in the album.

The only reason it works before you "apply modifications", is that the position field defaults to 0 and so all the files have the same position.

I agree that this is not desired, but there's nothing you can do since there is only one "position" setting for each file, which is defined by the order you set in the file's home album.  Once the linked files are pulled in by the query, they look like all the other home files and you cannot distinguish them.

One work-around would be to rewrite all desired queries into two queries where the linked files are pulled in by the second query while the first only pulls home files in.  Then you can concatenate the two, and have all the linked files at the end.  But if you don't have "position descending" set, it won't make sense since they won't be in alphabetical order or whatever else you choose.

I don't know if this should be considered a bug or an as-of-yet un-implemented feature of linked albums.
Logged

amiyuy

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 9
    • K.Y.O. Cosplay gallery
Re: Thumbnail sorting and linked files
« Reply #2 on: June 17, 2006, 01:20:23 am »

Ah, that makes complete sense.  I was actually wondering if that might be the case, but wasn't sure.

Quote
One work-around would be to rewrite all desired queries into two queries where the linked files are pulled in by the second query while the first only pulls home files in.  Then you can concatenate the two, and have all the linked files at the end.  But if you don't have "position descending" set, it won't make sense since they won't be in alphabetical order or whatever else you choose.
Since I don't know myself how to write mods or anything for this gallery, I unfortunately couldn't do it, but I understand what you mean.

Perhaps this could become a feature in a future version where you could choose (either globally and/or individually per-album), if the "Position ___" option is chosen, where to put linked files within an album (beginning, end, mixed)  and probably have a similar message to that which is on the "Sort my pictures" page:
The custom sort order you can specify on this page will only be taken into account if:
     * the admin has set the "Default sort order for files" in the config to "Position descending" or "Position ascending" (global setting for all users who haven't chosen another sort option individually)
     * the user has chosen "Position descending" or "Position ascending" on the thumbail page (per user setting)


For the time being, if I were to switch the global sorting method, create a new folder, and move the pictures I do not want sorted into it, will they lose their position number and then be able to be set at 0 again?  (I did try this yesterday once, but it didn't seem to work, but I'm just checking to see if it should and I should try again.)
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Thumbnail sorting and linked files
« Reply #3 on: June 17, 2006, 07:32:38 am »

I've also wanted to add more functionality to the sort utilities.

If you merely choose a new album for a picture, it won't change the sort order right then since the "position" field is not affected, only the "aid" (or album ID) is changed.

A quick thought about resetting the "position" field to 0 would be to enter an SQL command into a tool like phpMyAdmin to change the tables manually.  Such a command could also be written in a mod for Coppermine, with a button or link.

If you pick something specific you want, I can probably write up a quick mod.  For example, if you merely want all the linked files at the end of each album in the thumbnail view, that's something specific.

Your experience at sorting might be useful as a feature request.   Please check out the Features Request board and start a new thread or add on to an existing one (there are some requesting new sort functionality).
Logged

amiyuy

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 9
    • K.Y.O. Cosplay gallery
Re: Thumbnail sorting and linked files
« Reply #4 on: June 17, 2006, 08:18:54 am »

Awesome.

I would really love if you could try making a mod for the linked files at the end of each album.  That way I can still choose the positions of the files within their normal album but then they won't interfere with the other photos in the album that they're linked in.

I will head over to the Features Request board and check it out.  I'll link back to this thread when I post.

Thank you so much for your help!
Logged

amiyuy

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 9
    • K.Y.O. Cosplay gallery
Re: Thumbnail sorting and linked files
« Reply #5 on: July 24, 2006, 03:18:51 am »

Sorry, I don't want to bother anyone by bumping this thread, but I was just wondering if you'd been able to work on the mod to put linked files at the end of albums yet.

I'm wanting to make a gallery available to the general public, but the intermixing of the pictures is really frustrating me and making me delay in hope that I might have this mod coming.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Thumbnail sorting and linked files
« Reply #6 on: July 24, 2006, 04:01:10 am »

No problem with the bump.  A reminder after 5 weeks is certainly reasonable.  I'll see what I can do in this coming week.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Thumbnail sorting and linked files
« Reply #7 on: July 25, 2006, 02:12:35 pm »

This might do what you want.  It's very simple but does require a hack to a core script.

In include/functions.inc.php, look for this block of code in the function get_pic_data:
Code: [Select]
        $sort_array = array(
          'na' => 'filename ASC',
          'nd' => 'filename DESC',
          'ta'=>'title ASC',
          'td'=>'title DESC',
          'da' => 'pid ASC',
          'dd' => 'pid DESC',
          'pa' => 'position ASC',
          'pd' => 'position DESC',
        );
Add after it this block of code:
Code: [Select]
        // MOD - add AID to sort order so linked files are grouped together
        $sort_array = array(
          'na' => 'filename ASC',
          'nd' => 'filename DESC',
          'ta'=>'title ASC',
          'td'=>'title DESC',
          'da' => 'pid ASC',
          'dd' => 'pid DESC',
          'pa' => 'aid ASC, position ASC',
          'pd' => 'aid DESC, position DESC',
        );
        // MOD - end

You could replace the first block of code, but I like to keep the core script intact and add on a block with the code hack.  That way, you can remove the code hack and the script will be back to normal.

Now, this code hack will group together files by album ID.  It will not necessarily put all the linked files at the end of every album - it will only do so for albums with an AID smaller than all the AIDs of the linked files.  If you really want the linked files to be at the end always, let me know and I'll look into this further.  But I thought I'd provide this quick hack in case this is sufficient for what you want.

In either case, I will look into this further sometime in the future for your feature request thread.  I think the current implementation of using position sorting for linked files is confusing so either position sorting has to be disabled for albums with linked files or an implementation like your request should be done.
Logged

amiyuy

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 9
    • K.Y.O. Cosplay gallery
Re: Thumbnail sorting and linked files
« Reply #8 on: August 06, 2006, 01:16:40 am »

I can't get it to work...

Whereas I don't know PHP, I do know HTML and can generally pick up on things, so I'm fairly sure I understand the coding involved.

However even if I remove the original code and just put in the mod one, it doesn't work.

I've attached a screenshot of one of the galleries I'm trying to do it with.  The code was applied at this time and yet all of the group images, which are linked from a seperate gallery, are still interspersed with the individual shots of the girl with the blonde hair in the pink shirt.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.