question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Download URL after generating a thumbnail

See original GitHub issue

How can i get an url to download the thumbnail image after it has being uploaded? The code below is used in the example, but i’m not sure how to grab an url from this image.

bucket.upload(tempLocalThumbFile, {
  destination: thumbFilePath
}).then(() => {
  console.log('Thumbnail uploaded to Storage at', thumbFilePath);
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
prescottpruecommented, Apr 20, 2017

@rodrigoreal You should be able to use getDownloadURL.

If you want to do it by hand, ammending the following to the beginning of your file path should work (replace <- your-bucket-name-here -> with your actual bucket name):

'https://storage.cloud.google.com/<- your-bucket-name-here ->/' // private prefix for files (requires you to be authed with google)
'https://storage.googleapis.com/<- your-bucket-name-here ->/'; // public prefix (your file must be set to public)

Also, you may want to use the issue template that is provided for this repo, or your issue may be closed.

1reaction
markgohocommented, May 29, 2017

For others coming to this issue to find a solution, I needed to call .makePublic() on the uploaded file as seen below in order to access the object, and then assign it to an img.src later on:

const projectId = `<your project id from the console project settings>`;
const destination = `<the intended destination for your file>`;

await bucket.upload(tmpFilePath, { 
  destination,
}, (err, file) => {
  if (err) return console.error(err);
  file.makePublic();
});

const storageURL = `https://storage.googleapis.com/${projectId}.appspot.com/${destination}`;
await admin.database().ref(`/pictures/${pictureSlug}`).update({ storageURL });
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get download url of Thumbnail after firebase resize ...
When you upload an image file to your specified Cloud Storage bucket , this extension: Creates a resized image with your specified ...
Read more >
How To Download a YouTube Thumbnail
If you want to download an thumbnail from a YouTube video, there's two ways to do it. The first way works if you're...
Read more >
How To Download YouTube Thumbnail Images Without Using ...
This is a brief video tutorial about How To Download YouTube Thumbnail Images Without Using Any Website or App. As a YouTube creator, ......
Read more >
How To Download YouTube Video Thumbnail Image (in less ...
URL for downloading someone else's YouTube thumbnail : ... Related Videos How To Create Clickable YouTube Thumbnails Without Photoshop ...
Read more >
How to download your video's thumbnail - Vidyard Support
Download your thumbnail image. Copied · Sign in to your Vidyard account · Select a video from your library, then copy the video's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found