How do I move from one entry to the next (gallery view) just by looking at large-scale images (attachments)?

I’m trying to figure out an easy way to open each photo entry (large-scale) and navigate to the next, the same way you would navigate using arrow keys on your keyboard. I’m not sure this is possible but I’m finding it very cumbersome to open full-scale images for each entry and quickly compare with adjacent entries. Has anyone found a quick, no fuss way to do this? Thanks

Hi Krystal, and welcome to the forum…

Let’s make sure we define “adjacent” with precision. Are you suggesting a way to scroll through images that are:

  1. … stored in attachment fields in subsequent rows?
  2. … literally “adjacent” in the same row but different attachment fields?
  3. … in the same row, and same attachment field?

Option #3, of course, is already supported in the UI (double click the first image, full image displays, and right and left arrows function like a slide show).

Hi Bill, thanks for responding to this. I am indeed talking about scenario 1. I’ve seen 3 in action though am trying to find a way to jump between entries (rows) by only viewing full-size images (one per row) in the attachment field. I am finding the gallery view limiting in that it takes quite a few extra steps to open an image full size and then navigate to other entries/rows. Just wondering if there’s a built-in way to do this, or some option for extended functionality to achieve this, or if this could become a future feature

Yeah, ok. This seams like a reasonable process. I have an idea that I’ll explore when my nine bosses are looking the other way.

1 Like

@Krystal_Kramer

I’m not sure this is the perfect approach to your solution, but it seems better given the requirements of paging through records which may (or may not) have multiple images attached.

Here’s a quick video that walks you through the Script Block.

You can install a script block into any base and copy and paste the script below to use it on any table/selected attachments field.

/*

   ***********************************************************
   Airdrop - Gallery Viewer
   Copyright (c) 2020 by Global Technologies Corporation
   ALL RIGHTS RESERVED
   ***********************************************************
   
*/

// display the title
output.markdown("# Gallery Viewer");

// get the table name
let sourceTable     = await input.tableAsync("Pick the table:");
let sourceTableName = sourceTable.name;

// get the field name
let sourceField = await input.fieldAsync("Pick the attachment field to be displayed:", sourceTable.id);
let sourceFieldName = sourceField.name;

// identify the fields to be exported
let aFieldList = [sourceFieldName];

// get the source data
// let sourceTable = base.getTable(sourceTableName);

// get the data set for this gallery
let result = await sourceTable.selectRecordsAsync();
let sourceRecords = result.records;

// get the record count
let recordCount = sourceRecords.length;

// iterate across all the records
for (var r = 0; r < sourceRecords.length; r++)
{
  
    // get the name of this image collection record
    var thisName = sourceRecords[r].getCellValue("Name");

    // get the array of images in this record
    let theseImages = sourceRecords[r].getCellValue("Images");
    let imageCount  = theseImages.length;

    // iterate across the image collection for this record
    for (var i = 0; i < theseImages.length; i++)
    {

        // clear the frame
        output.clear();
        
        // display the table
        output.markdown("# " + sourceTableName + ": " + thisName);
        // output.markdown("r = " + r.toString() + " :: i = " + i.toString() + " of " + imageCount.toString());

        // get the image formatted in markdown style
        var thisImage = "[![" + theseImages[i].id + "](" + theseImages[i].thumbnails.large.url + ")](" + theseImages[i].url + ")";
        output.markdown(thisImage);

        // prompt for action
        let action = await input.buttonsAsync('', ['<- Prev', 'Next ->']);

        // test to see which way we're going
        if (action == 'Next ->')
        {
            // do nothing - skip forward
        } else {
            // decrement the image array pointer
            if (i == 0) {
                if (r == 0) {
                    r = -1;
                    break;
                } else {
                    r -= 2;
                    break;
                }
            } else {
                i -= 2;  
             }
        }
    
    }

    // if at eof, start at the first record in the gallery
    if (r == (recordCount - 1))
      r = -1;

}
2 Likes

That’s an awesome solution, @Bill.French! You should submit a version of that to the custom block contest! That would really be helpful to people as a standalone block!

Thanks! It’s just a hacky little idea I came up with to help @Krystal_Kramer - not sure if it will work for her. I give you and Krystal full authority to run with this idea and the code and win! :wink:

It’s a long and distracting story, but with all the terms I am subject to in my work, I can’t enter the contests under the new terms in the fine print. But I can be a cheerleader and share ideas.

@Bill.French, this is amazing! I was scanning the forums to figure out how to scroll through attachments when I came by your solution. Super appreciated! I am hoping to utilize this for a time-sensitive work situation, but have a few questions about adding to the script.

  • Is there a way to avoid the highlighting of the image when it is hovered over?
  • In my table, there are two single-select fields, that I would love to be able to utilize in the script and I am curious if it is possible.

The use case is: The script is run for the gallery viewer, and below the image are the two single-select fields. Specifically, this is for judging an art show, so I’d like to see the image AND be able to select whether or not the piece is IN or OUT of the show (single select) and if it gets an award (again, single select). It would be amazing to be able to stay in the gallery viewer and update records with entry and award status as we scroll through.

Thank you in advance for considering this!