[ https://jira.fiware.org/browse/HELP-9523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fernando Lopez deleted HELP-9523: --------------------------------- > [fiware-stackoverflow] Referencing images stored in object storage containers (Wirecloud) from img tag > ------------------------------------------------------------------------------------------------------ > > Key: HELP-9523 > URL: https://jira.fiware.org/browse/HELP-9523 > Project: Help-Desk > Issue Type: Monitor > Reporter: Backlog Manager > Labels: fiware, fiware-wirecloud > > Created question in FIWARE Q/A platform on 18-08-2015 at 11:08 > {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/32069097/referencing-images-stored-in-object-storage-containers-wirecloud-from-img-tag > +Question:+ > Referencing images stored in object storage containers (Wirecloud) from img tag > +Description:+ > We want to develop a widget to upload images to containers. This is a very well documented task: > 1.- Object Storage Tutorial > 2.- Fireware-Wiki > 3.- OpenStack Object Storage Docs (Swift) > With all this you can manage to get (download), upload, delete files in a container. This is relatively clear. > On the other hand, we want to develop another widget to display images stored in a container. I think in something like this to show them: > <img src="public_object_url"/> > But I do not know how to do that. Where I get this public URL? Is there a public URL? Is it get in some step during the uploading process? > I am a bit lost how to do that. Any help would be highly appreciated. > Thanks in advance. > EDIT 1 > We get blocked displaying images once they are downloaded. > A look inside "img" tags shows this: > what is the string returned by URL.createObjectURL(). If we look inside this link, the browser displays this: > We have decoded the string coming in the property "value" and the image is there! > To get the image from the object storage server we used a very similar code that the one used in the operator Álvaro recommended. > objectstorage.getFile( containerName, > reports[i].urlImagen,{ > token: token, > onSuccess: onGetFileSuccess.bind(null, i), > onFailure: onGetFileFailure > }); > function onGetFileSuccess(index, picture){ > downloadedPicsCont--; > reports[index].urlImagen = URL.createObjectURL(picture); > if(!(downloadedPicsCont > 0)){ > MashupPlatform.wiring.pushEvent('reports_output', JSON.stringify(reports)); > } > } > The picture variable has the following structure, which seems to be ok too. > What is it happening? > EDIT 2 > Finally, we found the reason. We were downloading images that were created directly from the cloud and not with objectStorageAPI. In you upload images from the cloud, when you download them you get them inside cdmi objects so the URL.createObjectURL doesn't not work as expected. In the other hand, if you upload them using objectStorageAPI, when downloading them, they come in raw format, so the method works correctly. -- This message was sent by Atlassian JIRA (v6.4.1#64016)
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy