REALC
REALC

Reputation: 1

Can't display mssql image in a http table using php

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.

Upvotes: 0

Views: 454

Answers (1)

Pedro Lobito
Pedro Lobito

Reputation: 98921

try this:

<img src="data:image/jpeg;base64,/{$Photo}"/>

Upvotes: 1

Related Questions