Meteor-files: image's link "http://localhost/cdn..." on production

Created on 20 Dec 2016  路  8Comments  路  Source: veliovgroup/Meteor-Files

After deploying my app on production server, all image links stopped working.
Links look like http://localhost/cdn/storage/Images/zwf7bGsqbGzA/original/zwf7pcabGzA.jpg.
But if i manually change it to http://mysite.com/cdn/storage/Images/zwf7bGsqbGzA/original/zwf7pcabGzA.jpg, such link viewed as expected.
I get them by:
<img src="{{imageFile id}}"
from helper:

imageFile(id) {
    let imgFile = Images.findOne({_id:id});
    if (imgFile) return imgFile.link();
  }

in local dev app all images viewed also ok,
maybe you have thought over this case?

.link() question

All 8 comments

Hi @valorloff

Have you set ROOT_URL=http://mtsite.com env.var ?

@valorloff also you don't need to create a helper, there one defined for you - {{fileURL file}}, read more - https://github.com/VeliovGroup/Meteor-Files/wiki/Template-Helper

@valorloff is this solved on your end?

Yes!
Big thank for your help and wiki!
Is it true that the maximum number of files (for performance reasons) in storagePath should not exceed 10k?

for the purpose of move to "fileURL" i changed my helper to:
imageRef() { return Images.findOne(); }
in template:
<img src="{{fileURL imageRef 'thumb'}}"
don"t show image,
Images.findOne() return file cursor, i come to my previously Images.findOne({_id:img_Id}).link(),
what's the secret?

Is it true that the maximum number of files (for performance reasons) in storagePath should not exceed 10k?

Where this statement came from? This is depends form FileSystem, read this SO thread

If you think you might hit the limits, there is two options:

  1. Use 3rd party storage, like in DB GridFS or AWS, etc.;
  2. Check this answer where I give a solution to build deep folder structure.

Hello @valorloff ,

Can we close this issue? Is it solved on your end?

Closed due to silence at issue owner end.

Was this page helpful?
0 / 5 - 0 ratings