# Manage images in social network

**URL:** <https://forum.ionicframework.com/t/manage-images-in-social-network/128689>\
**Category:** ionic-v3\
**Created:** [April 23, 2018, 8:38pm UTC](https://forum.ionicframework.com/t/manage-images-in-social-network/128689 "2018-04-23T20:38:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pasto92](https://avatars.discourse-cdn.com/v4/letter/p/b38774/32.png) [@Pasto92](https://forum.ionicframework.com/u/Pasto92)\
**Post date:** [April 23, 2018, 8:38pm UTC](https://forum.ionicframework.com/t/manage-images-in-social-network/128689/1 "2018-04-23T20:38:19Z")

</div>

Hi everyone! I’m developing a social network (something like Instagram).

I have a doubt about how to display photos in posts:

Method 1, result.immagine is a base64 image:

```auto
<ion-card *ngFor="let result of results">
        <ion-card-header>
                ...
        </ion-card-header>
        <ion-card-content>
          <img src="data:image/JPEG;base64,{{result.immagine}}"/>
        </ion-card-content>
      </ion-card>

```

Method 2, result.immagine is a link ([http://www.xxxxx.it/image.jpg](http://www.xxxxx.it/image.jpg)):

```auto
<ion-card *ngFor="let result of results">
        <ion-card-header>
                ...
        </ion-card-header>
        <ion-card-content>
          <img src="{{result.immagine}}"/>
        </ion-card-content>
      </ion-card>

```

Which method is better, and why?  
Why method 1 doesn’t show any image, returning error for unsafe image, and how can I resolve this issue?

Thank you.

---

<div class="post-metadata">

**Author:** ![morphist](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/morphist/32/127474_2.png) [@morphist](https://forum.ionicframework.com/u/morphist)\
**Post date:** [April 23, 2018, 11:34pm UTC](https://forum.ionicframework.com/t/manage-images-in-social-network/128689/2 "2018-04-23T23:34:20Z")

</div>

I would use method 2, but do [src]=“result.imagine”. This is cleaner and easier to work with. If you have performance concerns - then you could figure out optimization paths.

As for method 1 - please provide more description of the error. But most likely you face DOM sanitization issue: [https://angular.io/api/platform-browser/DomSanitizer](https://angular.io/api/platform-browser/DomSanitizer)

---

<div class="post-metadata">

**Author:** ![Pasto92](https://avatars.discourse-cdn.com/v4/letter/p/b38774/32.png) [@Pasto92](https://forum.ionicframework.com/u/Pasto92)\
**Post date:** [April 24, 2018, 6:26am UTC](https://forum.ionicframework.com/t/manage-images-in-social-network/128689/3 "2018-04-24T06:26:48Z")

</div>

Why would you use method 2 instead of method 1?  
Do I have to make public my static files with method 2? So, every user can access to any photo typing [http://xxxxx/image.jpg](http://xxxxx/image.jpg) in a browser, right?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:38pm UTC](https://forum.ionicframework.com/t/manage-images-in-social-network/128689/4 "2021-07-19T21:38:51Z")

</div>

Closed on July 19, 2021, 9:38pm UTC


