{'LongReadLen'}=2**20; # # Get the image as a blob $sth=ociparse($dbh, "select image, name from blog_images where message_id=$image_id") or die( "Can't prepare: " . ocierror() . "\n"); $result = ociexecute($sth) or die( "execute failed: $" . ocierror() . "\n"); $rows = ocifetchstatement($sth, $row); # figure out the image type from the file name (stored in database) $type = array(); preg_match('/\.(\w+)$/', $row['NAME'][0], $type); $type[0] = substr($type[0], 1); $type[0] == "jpg" && $type[0] = "jpeg"; # send the image, header style. header( "Content-type:image/$type[0]"); print $row['IMAGE'][0]; ?>