离子在卡视图中显示图像

时间:2019-05-16 22:42:32

标签: mysql ionic3

我想问一个正确的方法来显示从mysql到离子离子卡的图像。我的图像没有出来。

这是我的php,country_img是图片属性

if($postjson['aksi'] == 'get_negara'){
    $data = array();
    $query = mysqli_query($mysqli, "SELECT * FROM countries ORDER BY id ASC");

    while($row = mysqli_fetch_array($query)){

        $data[] = array(
            'id' => $row['id'],
            'country_name' => $row['country_name'],
            'country_img' => $row['country_img'],
        );
    }

if($query) $result = json_encode(array('success'=>true, 'result'=>$data));
else $result = json_encode(array('success'=>false));

echo $result;

}

这是我的国家。html

 <ion-card *ngFor="let detail of details">
      <ion-item >
          <img src= "data:image/jpg;base64,{{detail.country_img}}" />
          <h2>{{ detail.country_name }}</h2>
    <ion-icon name="arrow-forward" item-right (click)="showdata(detail.id)"></ion-icon>
      </ion-item>
  </ion-card>

这是我的国家。ts

loadcountry(){
let body = {
  aksi: 'get_negara'
};
this.postPvdr.postData(body, 'aksi_negara.php').subscribe(data => {
  for(let detail of data.result){
    this.details.push(detail);
    console.log(data);
  }

});
}

0 个答案:

没有答案