Home » Php » Get Blob image from mysql in json and convert to bitmap

Get Blob image from mysql in json and convert to bitmap

Posted by: admin October 29, 2018 Leave a comment

Questions:

I am getting get a response in php in json array which holds two value “name” and “image”(in blob). I would like to convert the blob to bitmap in my android application. Can someone help me to solve this?

As you can see below, this is my php code.

$sql = "SELECT * FROM bim WHERE category = '$category'";
    $r = mysqli_query($conn,$sql);

    $result = array();

    while($res = mysqli_fetch_array($r)){

        array_push($result,array(
        "signText"=>$res['signText'],
        "image"=>$res['image'] // i'm not sure if this right
    )
    );
    }
    echo json_encode(array("result"=>$result));
    mysqli_close($conn);
Answers: