0

I know there are many post about displaying a image from mssql, but they seems dont work in my case if i want it display with other table items.

I can display the binary image indivially by the following code

echo $image=base64_decode($MyBinImg);

then when i wanted to display the image into a table using smarty, it doesnt work

php side:

$smarty->assign("Photo",$image);
$smarty->assign("SomeText","hello world");

tpl side:

<some tags>
..
...
<tr>
<td style="background-color: #d0d0d0;"><b>TEXT</b></td>
<td style="background-color: #f0f0f0;">{$SomeText}</td>
</tr>
<tr>
<td style="background-color: #d0d0d0;"><b>Photo</b></td>
<td style="background-color: #f0f0f0;"><img src="{$Photo}"/></td>
</tr>

The table can display SomeText but not the Photo. Can someone tell me how to display it.Thanks.

REALC
  • 1
  • `` is usually used with files rather than by embedding binary data into HTML. – binaryLV Aug 19 '11 at 07:06
  • Possible duplicate - http://stackoverflow.com/questions/2429934/is-it-possible-to-put-binary-image-data-into-html-markup-and-then-get-the-image-d (I'm not sure if it works on all browsers; you'll also probably have to know the type of an image, i.e., if it is gif, jpeg, png or other type) – binaryLV Aug 19 '11 at 07:08

1 Answers1

1

try this:

<img src="data:image/jpeg;base64,/{$Photo}"/>
Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268