How about, I want to use json_encode
to make a json of an image obtained from the database, this I have but it does not work just send me the blank page and it does not show anything of json
:
<?php
define('HOST','host.com');
define('USER','usuario');
define('PASS','contraseña');
define('DB','baseDatos');
$con = mysqli_connect(HOST,USER,PASS,DB) or die('Unable to Connect');
$sql = "select imagenes from imagenes";
$res = mysqli_query($con,$sql);
/*$resultado= mysqli_fetch_array($res);
echo '<img src="data:image/jpeg;base64,'.base64_encode( $resultado['imagenes'] ).'"/>';*/
$result = array();
while($row = mysqli_fetch_array($res)){
array_push($result,array('url'=>$row['imagenes']));
}
echo json_encode(array("result"=>$result));
mysqli_close($con);
?>
It should be noted that I have 2 images in the database and they are of type BLOB