Script to rename photo files

Viewing 1 reply thread
  • Author
    Posts
  • November 4, 2023 at 7:44 AM #50086

    David Schwane
    Participant

    Photos are uploaded with various file names.

    Later, photos are downloaded using the built-in “Save Photo to Drive”

    Request is when photos are saved to drive, that they have the filename as one of the fields

    so instead of R-3220837-1321636325.jpg, it would be Fieldcatalogno.jpg

     

    would prefer to run script as a batch since I’m using built-in upload download functions, and once corrected, some sort of script that corrects future uploads.

    November 5, 2023 at 8:43 PM #50088

    Brendan
    Keymaster

    Hi David,

    I was just playing around with writing a script for you, but then realized that it wouldn’t work. When you add a photo to a record in Tap Forms, the data is stored in two places for the photo. The record holds a dictionary with the photo field’s metadata, including the filename. But also, the record’s internal representation in the CouchbaseLite database holds a reference to that photo too. It uses the filename to hold that reference. So if you rename the value in the photo field’s metadata for the specified photo, it will no longer match the photo referenced in the record’s internal representation of attachment data in the CouchbaseLite database.

    In my testing when I renamed the photo from JavaScript, it was not able to also rename the record’s attachments data, so it effectively removed the photo from display.

    So at the moment, there’s no function to rename a photo from JavaScript.

    Thanks,

    Brendan

Viewing 1 reply thread

You must be logged in to reply to this topic.