Get Started         Best Practices         Developer Guide         FAQ        
Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Getting a reference to the actual image for content in an item in the on-device collection

Brian H. Mayo Nov 23, 2017

I am using an on-device collection, which is synced up and working correctly.
I created an Item Factory and a Content Factory.

I have a collection with an item that has a content of type image. It all is working correctly.

Here is what I am trying to do:
In the factory I am persisting to Core Data (ios) information about the item and the item's content. A piece of data I want to persist along with an image content is the thumbnail of the image.

The question is: How can I get reference to the actual image (png or jpg) that is used for the image content in the item?

There does not appear to be anything in the SDK that allows for this. I know that I can get the URL to the image, but that actual image file is already in the Bundle that is on the device or it gets downloaded to the device on the sync. I don't want to have to make a network call to fetch the image via the URL when I already have it on the device.

Thank you.


( Agent )
Luis Martinell

Nov 23, 2017

Hi Brian,

No. The original image is not stored in the on-device bundle. It is not needed for the AR so we don’t store it.

Best regards,
Luis

0 rated
Brian H. Mayo

Nov 24, 2017

There may be some confusion about what I am asking about. I believe from your CraftAR terminology, you are referring to an "image" as the image that is used for image detection, which is also referred to as the "reference image". There is also the concept of a media type "image" that can be added as a content to an item. It is the media image I am referring to as stated in my question, an image content.


Let me make sure we are talking about the same SDK and bundle.

I am using the Craft AR Pro SDK v2.0. I have one collection and some items in the collection. I have image image defined and added as content in the items.

Through the Web management site, I generate the On-Device Bundle for my app and I down load it (a .zip file).
I then unzip the file and view the directories.

There is a collection.json file, a directory name with the collection UUID) and a media directory.
In the media directory there are directories named for UUIDs, one for each media I am using in an item.

In the media directory in each UUID directory there the images and videos I am talking about.

So, given all that, how through the CraftAR Pro SDK can I access a specific image file or video file that exists in that collection bundle loaded on the device? Do I have to attempt to get a handle on the .zip file myself, open it up, and manually find my way to the .mp4 video or .jpg|.png image file?

Regards,
-Brian M.
0 rated
( Agent )
Luis Martinell

Nov 24, 2017

Hi Brian,

I got confused. The media folder is stored in the app’s data directory ((NSApplicationSupportDirectory)/collections/media on iOS, CraftARCollections/media on Android.

I hope this helps.

Best regards,
Luis

0 rated
Brian H. Mayo

Nov 24, 2017

Okay, thank you for that response. I figured there was a terminology mis-connection.

Follow-on question with a little more complexity.

Let me set the stage:
1) I use the Management API to create an Item with content, let's says direct url image references, they are NOT stored with CraftAR as formal media elements.
2) I generate an on-device Collection Bundle and include this with my app that is deployed to users. At this point, the images are included in the Collection Bundle .zip file and should be in the directory/location you provided.
3) I make changes to the Collection, let's say adding more content to Items with additional direct URL image references (NOT stored with CraftAR as formal media)
4) When the user runs the app, I call a "sync" against the CraftAR service, which will update the Collection information, thus updating the information about the Collection, in turn the Items, in turn the addition of the new images.

Here is where the question starts -- when the sync happens, does the SDK in fact pull down onto the device the images for the direct url referenced image content, thus making whole that directory with a full complement of images .. just like it would be if I were to re-generate the Collection Bundle, include it in the app, and redeploy the app?

Regards,
-Brian M.
0 rated
( Agent )
Luis Martinell

Nov 27, 2017

Hi Brian,

Even if it seems like something the SDK should obviously do, it doesn’t. We are working towards releasing this before christmas, though.

Right now, after you sync a collection, all the contents of the added/modified AR items, get “converted to cloud” meaning they will be streamed when the AR content object is created.

For now, the only thing you can do is re-generate the on-device bundle and downlaod the whole thing every time instead of syncing.

Best regards,
Luis

0 rated
Brian H. Mayo

Nov 27, 2017

Luis,
Thanks for the response. As a software engineer, I appreciate the challenge of maintaining SDK consistency, gathering and consider client requests, and trying to roll out new features. I am digging deep in an app that is taking full advantage of the CraftAR offering, hence my volume of questions.

I appreciate the responses and look forward to working more with the SDK, Management API, and future releases.

Regards,
-Brian M.
0 rated

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Couldn't find what you were looking for?

support@catchoom.com
https://cdn.desk.com/
false
catchoom
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete