Forum

Loading images from server (AWS S3) not working

08 January 2018 20:08
I'm unable to load images from Amazon's AWS S3 – a remote server. How can I get it to work?

I'm doing this by changing the json info before it gets served.

This worked in a project I did with blend4web version 16.05. And it works now (version 17.10) for the binfile. But not for the images.

The app also works now when I have relative paths (no 'https://'), where the assets are on the same server.

But with absolute paths (with 'https://', )I get this error:
 B4W ERROR: image "Normal" has unsupported format or broken path.


Here's how the json is changed for each image (in images array):

"name": "Normal",
"size": [
2048,
2048
],
"uuid": "f5fa81f0f15ecf493c7f6d3fce277bad",
"source": "FILE",
"filepath": "https://mockup3d.s3.amazonaws.com/test/can_test/can%20normal%20v2.png?AWSAccessKeyId=AKIAJOX33XW3K22K3JNA&Signature=hNUYo%2FnSX0BkWlFk1%2FnY%2Fx6mNFM%3D&Expires=1515432296&",
"colorspace_settings_name": "sRGB"


I need to have all that stuff (the query string) after the ".png" so I can show private assets from S3. They assets need to be private because some of my clients have confidential information.

How can I get these assets to load correctly?
09 January 2018 23:13
Looked a bit more into this. Turns out the filepaths in the json in the can't have a querystring – that's the thing you get at the end of some urls after the question mark – ?a=something&b=something_else.

 This works:
"filepath": "normal.png"

This doesn't:
"filepath": "normal.png?val=something&"


To be honest, this is a bit frustrating. Using querystrings and http:// worked in the previous version of blend4web*. The assets are retrieved through simple http requests so I'm not sure why this isn't working.

Is there a good way around this?

Jeremy


* I did have to add a & at the end of the querystring because blend4web adds a ?v=<version> to the http requests, but this worked fine.
10 January 2018 17:18
I figured out how to make it work. If it helps anyone the json file has to be of the form:
"filepath":"normal.png"

It has to say ".png" or ".jpg" or whatever. But it can be a redirect to another file, which is what I did.

I suspect this has to do with blend4web accessing alternate, compressed textures. It's a bit annoying that we can't just use a simple url to access the assets since they are just basic http requests. But I managed to make it work.

– Jeremy
10 January 2018 18:16
It's good that you've found a workaround. We will investigate the issue.
Alexander (Blend4Web Team)
twitter
 
Please register or log in to leave a reply.