douqulv6059 2015-10-05 06:17 采纳率: 0%
浏览 57
已采纳

如何有效地通过JSON从MYSQL服务器获取BLOB映像文件

My MYSQL db contains 5 rows

id, name, username, password, email, image

The image type is BLOB.

My PHP codes below to get JSON data from MYSQL.

while($row = mysqli_fetch_array($res)){
     array_push($result,
         array('id'=>$row[0],
               'name'=>$row[1],
               'username'=>$row[2],
               'password'=>$row[3],
               'email'=>$row[4],
               'image'=>$row[5])
               ));
}

echo json_encode(array("result"=>$result));

My application will load longer than expected to parse the base64 image string from the returned JSON.

So what's the best way to store and retrieve image file efficiently?

  • 写回答

2条回答 默认 最新

  • douyue5856 2015-10-05 06:31
    关注

    I had a similar problem. So I avoided storing images in MySql. I am storing them in the server as image files and using picasso to show the images. Its super easy to transform and use.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持