How to display image downloaded from cloud storage in the browser?

TheProgrammer

Currently, I download the image from my cloud storage bucket, encode it in base64 and then pass it in data uri in the src attribute of an img tag.

Is there any other way to do this ?

router.post('/images', function(req, res, next) {
    var image = bucket.file(req.body.image);
    image.download(function(err, contents) {
        if (err) {
            console.log(err);
        } else {
            var resultImage = base64_encode(contents);
            var index = req.body.index;
            var returnObject = {
                image: resultImage,
                index: index
            }
            res.send(returnObject);
        }
    });
});
Joshua Royalty

Is the image publicly readable? If so you can just use

<img src="http://<bucket>.storage.googleapis.com/<object>">

Otherwise you will need to generate a signed URL for a GET operation, which can be used in an image tag.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to replace downloaded image with same file name in storage from server?

From Dev

How to upload an image to Google Cloud Storage from an image url in Node?

From Dev

JavaScript: How to check if image or any asset is stored by the browser and not downloaded from the internet

From Dev

How to upload an image from web into Google Cloud Storage?

From Dev

how to get a image from google cloud storage in java?

From Dev

How to get image manipulation url from Google Cloud Storage?

From Dev

How can I access files from a Google Cloud Storage bucket from a browser?

From Dev

When Is a Downloaded Image Cached by the Browser?

From Dev

iOS select image from cloud storage

From Dev

How to load previously downloaded pdf from cache or external storage

From Dev

How can I display an image from Firebase Storage without repeating image in the loop

From Dev

How to display external storage image in imageview

From Dev

How to display external storage image in imageview

From Dev

How to upload an image from client side form to Google cloud storage bucket?

From Dev

How Can I Return Specified Image Size From Google Cloud Storage With Node API?

From Dev

How to display an image in a canvas object in tkinter using the path obtained from file browser

From Dev

How do I display all of the images from my Firebase Storage in React Native without needing image names?

From Dev

how to convert idhttp downloaded image from extention to another?

From Dev

How to place AsyncTask image being downloaded from JSON object in ListView?

From Dev

how to convert idhttp downloaded image from extention to another?

From Dev

Browser will not display image

From Dev

Can't load public image from Google Cloud Storage with Fresco

From Dev

Unable to download image from Google Cloud Storage url with Android

From Dev

Can't load public image from Google Cloud Storage with Fresco

From Dev

Firebase Cloud functions remove orphan image from storage using url

From Dev

Android: Save image from Internal storage in SharedPreferences and display it

From Dev

Gallery can't display image from internal storage

From Dev

How to upload file from google cloud instance to cloud storage with IAM?

From Dev

How to delete a single Cloudinary image from browser?

Related Related

  1. 1

    How to replace downloaded image with same file name in storage from server?

  2. 2

    How to upload an image to Google Cloud Storage from an image url in Node?

  3. 3

    JavaScript: How to check if image or any asset is stored by the browser and not downloaded from the internet

  4. 4

    How to upload an image from web into Google Cloud Storage?

  5. 5

    how to get a image from google cloud storage in java?

  6. 6

    How to get image manipulation url from Google Cloud Storage?

  7. 7

    How can I access files from a Google Cloud Storage bucket from a browser?

  8. 8

    When Is a Downloaded Image Cached by the Browser?

  9. 9

    iOS select image from cloud storage

  10. 10

    How to load previously downloaded pdf from cache or external storage

  11. 11

    How can I display an image from Firebase Storage without repeating image in the loop

  12. 12

    How to display external storage image in imageview

  13. 13

    How to display external storage image in imageview

  14. 14

    How to upload an image from client side form to Google cloud storage bucket?

  15. 15

    How Can I Return Specified Image Size From Google Cloud Storage With Node API?

  16. 16

    How to display an image in a canvas object in tkinter using the path obtained from file browser

  17. 17

    How do I display all of the images from my Firebase Storage in React Native without needing image names?

  18. 18

    how to convert idhttp downloaded image from extention to another?

  19. 19

    How to place AsyncTask image being downloaded from JSON object in ListView?

  20. 20

    how to convert idhttp downloaded image from extention to another?

  21. 21

    Browser will not display image

  22. 22

    Can't load public image from Google Cloud Storage with Fresco

  23. 23

    Unable to download image from Google Cloud Storage url with Android

  24. 24

    Can't load public image from Google Cloud Storage with Fresco

  25. 25

    Firebase Cloud functions remove orphan image from storage using url

  26. 26

    Android: Save image from Internal storage in SharedPreferences and display it

  27. 27

    Gallery can't display image from internal storage

  28. 28

    How to upload file from google cloud instance to cloud storage with IAM?

  29. 29

    How to delete a single Cloudinary image from browser?

HotTag

Archive