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

John Tyrrell

How can I display a image from Firebase Storage without repeating the image in the loop? I succeeded in fetching the image data from storage but cannot display the images as a different image in that array. It just returns the same image in the loop.

HTML

<div *ngFor="let list of listings"class="row">
  <img [src]="imageUrl"/>
</div>

JavaScript

ngOnInit() {

    this.listings = [];
    this.listingss = [];

    this.firebaseService.getListings().subscribe((data: any) => {

          data.forEach(listings => {
                this.listing = listings
                this.listings.push(listings);

                //listings logged
                console.log(listings);

                // get the reference
                let storageRef = firebase.storage().ref();
                //store the path
                let spaceRef = storageRef.child(listings.path);
                //Images logged
                // console.log('images:', listings.path);

                //download the url
                storageRef.child(listings.path).getDownloadURL().then((url) => {

                      //url is our firebase path which we store as a var imageUrl
                      this.imageUrl = url;

                      //push out the listings array of data//
                      // this.listingss.push(listings);
                      console.log(url);
                      console.log("this was a success");
slaesh

You are overwriting that imageUrl property everytime.

You have to save that image into your array-element:

listings.imageUrl = url;
<div *ngFor="let list of listings"class="row">
  <img [src]="list.imageUrl"/>
</div>

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 do I display all of the images from my Firebase Storage in React Native without needing image names?

From Dev

How can I make array of image from Firebase storage?

From Dev

How can I get image path from Firebase, get image from firebase storage, and show it?

From Dev

How can I test retina image substition without retina display?

From Dev

How can I remove a duplicate image without display:none?

From Dev

How would I reference an image in firebase storage?

From Dev

How to bind image in angularjs from firebase storage

From Dev

How can I display image file object from java to jsp?

From Dev

How do I save an image url from Firebase Storage to Firebase realtime data base, the image from my device

From Dev

Gallery can't display image from internal storage

From Dev

Firebase how to get Image Url from firebase storage?

From Dev

How can I display a Media picker image

From Dev

How can I display the image name on mouseover?

From Dev

How can I display an image using Pillow?

From Dev

How can I display a paragraph over image?

From Dev

How can I display an image in a JPanel

From Dev

how can I Display image in ExoPlayer?

From Dev

I can' display an image from sql database with php. How is it possible to display it and how can I display more pictures at a time?

From Dev

How can I display an image on top of an image in PyGame?

From Dev

How can I display binary image data as an Image in PHRETS

From Dev

How can I display an image on top of an image in PyGame?

From Dev

How to I display image from mysql PHP

From Dev

How do I display an image from an attachment?

From Dev

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

From Dev

Transfer image from firebase storage to firebase database

From Dev

How can I resize image with quality without saving image in Python?

From Dev

How to download image file from Firebase storage To sd card

From Dev

How can I view an image from Azure Blob Storage, rather than download it?

From Dev

How can I view an image from Azure Blob Storage, rather than download it?

Related Related

  1. 1

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

  2. 2

    How can I make array of image from Firebase storage?

  3. 3

    How can I get image path from Firebase, get image from firebase storage, and show it?

  4. 4

    How can I test retina image substition without retina display?

  5. 5

    How can I remove a duplicate image without display:none?

  6. 6

    How would I reference an image in firebase storage?

  7. 7

    How to bind image in angularjs from firebase storage

  8. 8

    How can I display image file object from java to jsp?

  9. 9

    How do I save an image url from Firebase Storage to Firebase realtime data base, the image from my device

  10. 10

    Gallery can't display image from internal storage

  11. 11

    Firebase how to get Image Url from firebase storage?

  12. 12

    How can I display a Media picker image

  13. 13

    How can I display the image name on mouseover?

  14. 14

    How can I display an image using Pillow?

  15. 15

    How can I display a paragraph over image?

  16. 16

    How can I display an image in a JPanel

  17. 17

    how can I Display image in ExoPlayer?

  18. 18

    I can' display an image from sql database with php. How is it possible to display it and how can I display more pictures at a time?

  19. 19

    How can I display an image on top of an image in PyGame?

  20. 20

    How can I display binary image data as an Image in PHRETS

  21. 21

    How can I display an image on top of an image in PyGame?

  22. 22

    How to I display image from mysql PHP

  23. 23

    How do I display an image from an attachment?

  24. 24

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

  25. 25

    Transfer image from firebase storage to firebase database

  26. 26

    How can I resize image with quality without saving image in Python?

  27. 27

    How to download image file from Firebase storage To sd card

  28. 28

    How can I view an image from Azure Blob Storage, rather than download it?

  29. 29

    How can I view an image from Azure Blob Storage, rather than download it?

HotTag

Archive