Reply to Re: How to insert and select images from postgres db

Your name:

Reply:


Posted by andreja on 10/21/06 11:12

i have done this before, but with mysql
here is the way:

<?
// you'l have to make file imageCreator.php
// with this content
// do not leave any content or blan spaces befor <?
// at he begining of the code!!!
// because of header information

function createImageFromDatabase($someID){
$host = "host";
$user = "root";
$pass = "";
$dbName = "imageDB";
$conn = mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($dbName, $conn);
$qry = "select img.rowdata from rowdata where imgID = $someID";
$result = mysql_query($qry, $conn) or die(mysql_error());
$data = mysql_fetch_assoc($result);

$imageContent = $data['rowdata'];
$image = imagecreatefromstring($imageContent);

header("Content-type: image/png");
imagepng($image);
}
createImageFromDatabase($_GET['imageID']);
?>

now your link in other file , whitch will display a picture, would be
<img src="imageCreator.php?imageID=76187"/>



"J.F.Kishor" <kishor@ooty.tenet.res.in> wrote in message
news:Pine.LNX.4.33.0503301706440.20884-100000@kuruvi.ooty.tenet.res.in...
> Hi,
>
> I am having a problem in storing and selecting images in and
> from postgres.
>
> My requirement is I have to select the image from the database
> and display it in User Interface.
>
> Can anyone help me through this problem, I'am in need of this
> solution by today.
>
>
>
> Regards,
> - JFK
> kishor
> Nilgiri Networks

[Back to original 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

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