potresti fare così:
ti crei una pagina php che si chima immagine.php e ci metti dentro:
Codice PHP:
<?php 
$id
=$_GET['id'];
$conn = @mysql_connect('mysql''user''pass'); 
if(!
$conn){exit('

Non è possibile connettersi.</p>'
);} 

if(!
mysql_select_db('datatab_db1')){exit('

Non è possibile connettersi.</p>'
);} 

$id 1

$q = @mysql_query("SELECT name, type, filedata FROM dbdiprova WHERE id=$id"); 
if(!
$q){exit('

ERRORE: ' 
mysql_error() . '</p>');} 

$f mysql_fetch_array($q); 
if(!
$f){exit('

ERRORE: ' 
mysql_error() . '</p>');} 
$name $f['name']; 
$tipo $f['type']; 
$data $f['filedata']; 

header("content-disposition: inline; filename=$name"); 
header("content-type: $tipo"); 
header('content-length: ' strlen($data)); 

echo 
$data
exit(); 
?>

poi nella toa pagina test.php:

Codice PHP:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<
html xmlns="http://www.w3.org/1999/xhtml"
<
head
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<
title>Upload</title
</
head

<
body
ciao [img]immagine.php?id=1[/img]
</
body
</
html
Ciao
Scuba