You are here: Re: Images from DB « PHP Programming Language « IT news, forums, messages
Re: Images from DB

Posted by Mike Willbanks on 10/18/05 15:04

José Checa,
> Hello all.
>
> I have a function in PHP to retreive a BLOB field in Oracle DB who has a
> JPEG image in it; but I don´t know how show it in an html page with text
> information, I have something like this, but doesn´t work properly:
>
> Any idea. Thanks in advance. Pepe.-
>

Create a file that calls the image, outputs the header for the jpeg and
then dumps the data in that file. You can not just output the image
directly into the src area ;)

Something like:
image.php
$conn = oci_logon();
$stmt = oci_parse($conn, 'select image_blob from images where image_id =
:image_id');
$image_id = (int) $_GET['image_id'];
oci_bind_by_name($stmt, ':image_id', $image_id);
oci_execute($stmt);
$row = oci_fetch_assoc($stmt);

header('Content-Type: image/jpeg');
echo $row['IMAGE_BLOB'];

Something like that, I did not check it but most of it was for php5 ;)

--
Mike Willbanks
Zend Certified Engineer
http://www.digitalstruct.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация