New Homepage Forums Special Shields Camera – How to get LastPicture file name

This topic contains 4 replies, has 2 voices, and was last updated by avatar iceman2 10 months, 1 week ago. This post has been viewed 137 times

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #132067
    avatariceman2
    Participant

    I want to get the file name of the last picture taken. I would prefer to include this with the data logger so I can include it in the .csv file, but any other way will do. Thanks!

    #132463
    avatarAmr
    Keymaster

    Hi,

    Sorry, but the camera shield has no such function to get the last captured photo name .. but if you want to get the last photo in your hand then you can send it via the Email Shield with this function:
    Email.attachLastPicture("[email protected]","SubjectIncludedHere“,”bodyOfEmail", 0/1);

    And let me know if this helps …

    #132473
    avatariceman2
    Participant

    Hi Amr,

    Thanks for your reply. Can you tell me what the 1Sheeld+ nomenclature is that determines photo file names? For example, one of my photos is named 1551555158141. This seems to be time-based.

    What I want to do is:

    – take a photo
    – use the data logger to grab various data such as lux value and time of photo
    – upload the photo to Google Photos,
    – append the .csv file to a Google Docs spreadsheet,
    – add a URL for the photo to the spreadsheet on the same row as the data.

    If I can estimate the photo name it might help me establish its URL on the Google Photos server.

    Thanks for all your help!

    #133305
    avatarAmr
    Keymaster

    Unfortunately, there’s no available function in the 1Sheeld library that can automatically return the photo name and I am not sure how the photo gets named. I think this is back to the phone’s camera and system. But if you want to upload the last photo to the google photos then you can use this code:

    And it’s available in the Internet Shield
    For the .CSV file, Internet Shield can handle HTTP requests but you can’t attach a .CSV file with the requests (if this is what you want to make).

    Sorry for these limitations but I have issued them to the development team and they will consider working on them 🙂

    #133323
    avatariceman2
    Participant

    Hi Amr,

    I figured out how the filenames are set. They’re the number of milliseconds elapsed since a “zero time” of GMT Midnight on December 31, 1969. So my file with the name of 1553537321430.csv means the file was saved 1,553,537,321,430 milliseconds since the zero time. This is the same for data logs and photos saved by OneSheeld, which is very handy to know if you want to link a set of sensor data to an image or otherwise take actions based on the timing of file creation.

    Here’s how I figured it out:

    – The data logger adds a time stamp in one cell of the .csv file. I have Clock.queryDateAndTime(); in my sketch so that may be why it’s saving the time.
    – By counting the elapsed time between the file creation of two saved logs, I found that 732 seconds had elapsed between the two.
    – I then subtracted the later filename from the earlier one and got 732,468. This indicates that the filenames are a milliseconds-based time stamp which got me wondering what is the zero time.
    – My data logger file 1553537321430.csv contains a time stamp of 2019-03-25 11:08:41PST, which is GMT 18:08:41. 1,553,537,321,430 milliseconds is 17980.75604 days, which subtracted from the GMT timestamp gets you GMT 12:00 12/31/1969.

    Thanks for showing me how to upload to Google Photos.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.