Reputation: 17
I have some problem, i want to show image from my Database which is have a BLOB data type, here's my code
var gambar = new Array();
<?php include_once("koneksi.php");
$query3 = "SELECT a.gambarbyte from asset a";
$result3 = mysql_query($query3);
$coba1=array();
$i=0;
while ($row = mysql_fetch_array($result3, MYSQL_NUM)) {
$coba1[$i]=$row[0];
$i++;
}
?>
gambar = <?php echo json_encode($coba1); ?>;
var contentString = '';
//the Problem Is in Here
contentString += '<br><img src="data:image/jpeg;base64,'+ gambar[0] + ' />';
infoWindow.setContent(contentString);
infoWindow.setPosition(event.latLng);
infoWindow.open(map);
i want to set value var contentstring for infowindow with image that i load from Database, anyone help
Upvotes: 1
Views: 1106
Reputation: 2606
You are missing ", src does not end.
contentString += '<br><img src="data:image/png;base64,'+ base64blob + '"/>';
Here is a working JSFiddle demo: http://jsfiddle.net/iambnz/B2ZF3
Upvotes: 2