问题
I have images as byte []
and I will load it directly into Glide
some thing like this :
the Glide in recyclerView (Adapter):
Glide.with(ctx)
.load("http://192.168.1.8/connect/getimage.php")
.into(holder.img);
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;
I would get It directly without Json to put it into Glide .
回答1:
replace this ligne
$img=base64_encode($data['img']);
by :
$img=$data['img'];
and it should work
回答2:
You shouldn't send image as base64 string. Just send it as ordinary file.
来源:https://stackoverflow.com/questions/42876455/load-image-from-php-directly-into-glide