How to display stored image in a blank application

How to display stored image in a blank application

I stored my images in Oracle database. The database does not matter, MySQL is the same.

Scriptcase form and grid work fine when storing and displaying images. However, I need to retrieve the image and display it on a blank application.

For example, my table definition is:
create table my_table (my_image BLOB);

I auto-create form and grid based on the table above and they work fine.

I create a blank app and, to display the image correctly, in it I have the following code:

?>
<html>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8” />
<title>My Title</title>
</head>

<?php
// Retrieving image from the database
$sql = “SELECT my_image FROM my_table”;
sc_lookup(sc_image,$sql);
$l_IMAGE = {sc_image[0][0]};
?>

<body>
<div style="">
<h1><center><b>MY BLANK APP with IMAGE</b></center></h1>
<center>
<?php
echo ‘<img src="data:image/jpeg;base64,’.base64_encode($l_IMAGE).
‘"style=“display:block;width:auto;height:auto”/>’;
?>
</center>
</div>
</body>
</html>
<?php

The key is to use
data:image/jpeg;base64,’.base64_encode($l_IMAGE)
as the <img> tag.

Hope this code help someone as I was struggling to get it done.

DHa

Please change the line:
<h1><center><b>PICK SHEET - Order <?php echo [l_OUT_ORD_ID]; ?></b></center></h1>
to:
<h1><center><b>MY BLANK APP with IMAGE</b></center></h1>