Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

listing images

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?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

listing images

Hi Terry -

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

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

listing images

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

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

listing images

Hello Terry,

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

Please check your code. It may contain extra slash.

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

listing images

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

listing images

Hello Terry,

Thank you for the update, glad it works!

Return to “Issues”