Start a new topic

Load image from filesystem into wikitude

Load image from filesystem into wikitude


You're welcome! If you have any further questions, please feel free to ask!

Best regards

Andreas

Solved! Work like a charm.

Thank you so much Andreas!

Best regards

Hi Juan,
Saving a raw UIImage to disk and loading it will of course result in an error. You always need to load a .png or .jpg. Use the UIImage ; API to save a UIImage as a .png or .jpg to disk.

Don't worry about the error message. It's not related to any important component and does not affect the Wikitude SDK functionality at all. It's just a internal inconsistency.

Best regards

Andreas

 

I pass something like this /var/mobile/Containers/Data/Application/77FFAE4C-9741-4055-89E1-D92E80500776/Documents/image.jpg also checked /Documents/image.jpg and file:///var/mobile/Containers/Data/Application/77FFAE4C-9741-4055-89E1-D92E80500776/Documents/image.jpg

I save a uiimage into disk, i will try to save image as jpg or png instead.

One more question, sometimes wikitude sdk show me Wikitude SDK: ERROR -> connection could not be established  but everything seems to work well, I can call javascript methods comunicate javascript with iOS I do not understand it.

Regards

 

 

 

That's a very, very wired output.  Can you post the file url that you're passing into JS?

Best regards

Andreas

Hi Andres,

Yes indeed, I'm building a iOS App, and yes I download the image at runtime and save it in Documents folder.

I get the absolute path from NSFileManager API and tried to inject it into wikitude, I also print the path inside wikitude in order to verify it and it is correct.

Wikitude print the following error:

Failed to load ImageResouce (3) : LMNSSTUnoYuser time_GL draw command statisticscpu idle timem page sizeYtimestamp>driver events_vertex copy time_texture upload

With a image in the application sandbox works like a charm, but I need to this way :(

Regards

Hi Juan,
Am I right that you're building an iOS App?

If so, use the NSFileManager API to get a file URL for your Image. That URL has to be given to the AR.ImageResource (Use the WTArchitectView -callJavaScript API to injject the path from ObjC into JavaScript).

Do you download the image at runtime from a server and save it to the Documents folder? Because usually you package your application data not in the Documents folder, but add it as a folder reference to your Xcode project and then the data is in the application sandbox, not the application container. If you add your Architect World (with all assets like images) as folder reference, you can use relative paths to load/refer to these images.

Best regards

Andreas

I am trying to create an ImageResource from a image which is saved locally, more concrete in the /Documents folder inside app sandbox.

By the moment I tried with absoulute paths such as: '/var/mobile/Containers/Data/Application/XXXX_XXXX_XXXX/Documents/image.jpg'  and also '/Documents/image.jpg'

But I alway get an error and the image is never showed.

Is there any way to load a image from local folder? I load the images in my application dinamically so there is no way to have all the images before ejecution time.

Regards.
Login or Signup to post a comment