将图像直接从php加载到Glide [英] load image from php directly into Glide
本文介绍了将图像直接从php加载到Glide的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的图像为byte []
,我将其直接加载到Glide
像这样的东西:
I have images as byte []
and I will load it directly into Glide
some thing like this :
recyclerView中的Glide(适配器):
the Glide in recyclerView (Adapter):
Glide.with(ctx)
.load("http://192.168.1.8/connect/getimage.php")
.into(holder.img);
脚本PHP ==> getimage.php
The script PHP ==> getimage.php
$sql = "select img from table where id=1032 ";
$stmt = sqlsrv_prepare($this - > connection, $sql);
$result = sqlsrv_execute($stmt);
$information = array();
while ($data = sqlsrv_fetch_array($stmt)) {
$img = base64_encode($data['img']);
}
echo $img;
如果没有Json,我将直接获得它 放入Glide中.
I would get It directly without Json to put it into Glide .
推荐答案
替换此ligne
$img=base64_encode($data['img']);
作者:
$img=$data['img'];
它应该可以工作
这篇关于将图像直接从php加载到Glide的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文