Page 1 of 1

listing images

Posted: Fri Apr 03, 2015 1:57 pm
by Terry Gilliver

I am trying to list images from the files collection. I have a second collection called gallery which has the contains the image names from the files collection. I am performing a list service for the gallery collection and converting the image filename into a url for the corresponding items in the files collection. The image URL seems to be getting corrupted somewhere.

For example if I pass a URL of 'https://api.appery.io/rest/1/db/files...' It appears to be trying to save the image URL as 'http://appery.io/app/view/3e4a219b-e1...'

Here is a section from my console.log:

imageFilename = 10f120e0-0ffd-42d8-91a5-04df1ca6ac83.SA3.png
VM103081:278

imageURL = https//api.appery.io/rest/1/db/files/5422ac3ee4b0b7fdcc760e31/10f120e0-0ffd-42d8-91a5-04df1ca6ac83.SA3.png

GET http://appery.io/app/view/3e4a219b-e1... 404 (Not Found)

The list service is working correctly and has been used elsewhere without a problem.

list service mapping:

Image

The js for the image asset is as follows, this converts the filename to the URL:

pre//get image filename
var imageFilename = value;
console.log('imageFilename = ', imageFilename);
//get image URL
var imageURL = 'https//api.appery.io/rest/1/db/files/5422ac3ee4b0b7fdcc760e31/' + imageFilename;
console.log('imageURL = ', imageURL);
return imageURL;/pre

The console.log lines return the correct value, the the image is not displayed.

Any ideas?


listing images

Posted: Fri Apr 03, 2015 8:57 pm
by Illya Stepanov

Hi Terry -

Could you please show us what actually console.log returns as a value in the browser console?


listing images

Posted: Mon Apr 06, 2015 12:40 pm
by Terry Gilliver

Here are some sample images showing console and the resource it is trying to get. The resource is obviously incorrect, however, the console.log messages show that I have the correct values.

Image

Image


listing images

Posted: Tue Apr 07, 2015 9:17 pm
by Serhii Kulibaba

Hello Terry,

It works in our app:
http://gyazo.com/e0d44aaaff430c5ccce8...
http://gyazo.com/344d3032fc025c3417bf...

Please check your code. It may contain extra slash.


listing images

Posted: Fri Apr 10, 2015 3:58 pm
by Terry Gilliver

Ok, fixed it. There was no error in my code, but deleting the javascript and re-creating it sorted the problem but not sure why

Thanks


listing images

Posted: Fri Apr 10, 2015 8:40 pm
by Evgene Karachevtsev

Hello Terry,

Thank you for the update, glad it works!