RE: [PHP-DB] Showing an image

2001-07-02 Thread Beau Lebens

what you should actually do is save that script as something like
image.php and then on the page where you want to have text + images, do
something like


html
body
img src=image.php?uid=xxx border=0br
I am some text under the image that is grabbed from the DB
/body
/html

assuming that the image.php page accesses teh DB based on a car called uid'
which represents a key to pull the right image, in this case it is xxx :)

HTH
Beau


// -Original Message-
// From: kachaloo [mailto:[EMAIL PROTECTED]]
// Sent: Monday, 2 July 2001 3:38 PM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] Showing an image
// 
// 
// HI,
// I want to show an image from a database but to do that I am using :
//  $result = @mysql_query($sql);
//  $data = @mysql_result($result, 0, PICTURE);
//  $type = @mysql_result($result, 0, FILETYPE);
//  Header(Content-type: $type);
//  echo $data;
// 
// 
// but after this I also want to show some text info. How can I 
// do this ? I
// will have to use something else besides header. Please Help.
// Thanks,
// Vishal
// 
// 
// 
// -- 
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, e-mail: [EMAIL PROTECTED]
// For additional commands, e-mail: [EMAIL PROTECTED]
// To contact the list administrators, e-mail: 
// [EMAIL PROTECTED]
// 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Showing an image

2001-07-02 Thread kachaloo

Hi,
Thanks ! I get it now
Regards,
Vishal



- Original Message -
From: Beau Lebens [EMAIL PROTECTED]
To: 'kachaloo' [EMAIL PROTECTED]
Sent: Monday, July 02, 2001 3:56 PM
Subject: RE: [PHP-DB] Showing an image


 don't really know what you are doing here, the form that you have is
 multipart, but if you are trying to actually upload an image, then you
will
 also need an input type=file so you can browse and select that file.

 i am assuming that you alreayd have images saved in your database, which
can
 be accessed using the unique key imageID

 you then need to do something like what you are doing, grab all the image
 details (including mime type) from the db,

 header() the type of the image, then echo the contents

 this short script should be saved as something like image.php, when you
want
 one of the images from your database, you just put a normal html img
src=
 tag in your html code, but the location or src of your image will be
 something like image.php?id=23 which will load the image with id 23 from
 your database, into the img tag in your webpage.

 hope this helps, if i can find them, i can send some code samples when i
get
 home


 Beau



 // -Original Message-
 // From: kachaloo [mailto:[EMAIL PROTECTED]]
 // Sent: Monday, 2 July 2001 5:58 PM
 // To: [EMAIL PROTECTED]
 // Subject: Re: [PHP-DB] Showing an image
 //
 //
 // Hi Beau,
 //  The logic makes sense but I don't know how to
 // implement it ?
 // So pls explain it to me !!
 //
 // Thanks,
 // Vishal
 //
 // My code is :
 //
 // ___
 //
 //
 // view.php
 //
 // html
 // head
 // titleView the files/title
 // /head
 //
 //FORM ENCTYPE=multipart/form-data ACTION=show.php
 // METHOD=POST
 //bID/bbrINPUT TYPE=TEXT NAME=id BR
 //INPUT TYPE=submit VALUE=Send File
 ///form
 //
 //
 // /head
 // body
 //
 // /body
 // /html
 //
 // ___
 //
 // show.php
 //
 //
 // ?php
 //
 //
 //  $connection=mysql_connect('localhost','root')
 //  or die(Sorry could not connect to the database);
 //
 //  // select database
 //
 //  $db=mysql_select_db('punebuzz',$connection)
 //  or die(Sorry could not connect to the database);
 //
 //
 //
 //  // now the query
 //
 //  $sql=Select * from article where ID='$id';
 //
 //
 //  $result=mysql_query($sql);
 //
 // /*
 //  $result = @mysql_query($sql);
 //  $data = @mysql_result($result, 0, PICTURE);
 //  $type = @mysql_result($result, 0, FILETYPE);
 //  Header(Content-type: $type);
 //  echo $data;
 //
 //
 //  $cateory = @mysql_result($result, 0, CATEORY);
 //  $heading = @mysql_result($result, 0, HEADING);
 //  $body = @mysql_result($result, 0, BODY);
 //  $keyword = @mysql_result($result, 0, KEYWORD);
 //  $name = @mysql_result($result, 0, FILENAME);
 //  $size = @mysql_result($result, 0, FILESIZE);
 //  $id = @mysql_result($result, 0, ID);
 //
 //
 //  Header(Content-type: text/html);
 //  echo pbID/b$id/P;
 //  echo pbCATEORY/b$cateory/P;
 //  echo pbHEADING/b$heading/P;
 //  echo pbBODY/b$body/P;
 //  echo pbKEYWORD/b$keyword/P;
 //  echo pbFILENAME/b$filename/P;
 //  echo pbFILESIZE/b$filesize/P;
 //
 // */
 //
 //
 //  while ($row = mysql_fetch_object ($result))
 //  {
 //
 //  $cateory =$row-CATEORY;
 //  $heading =$row-HEADING;
 //  $body =$row-BODY;
 //  $keyword =$row-KEYWORD;
 //  $name =$row-FILENAME;
 //  $size =$row-FILESIZE;
 //  $id =$row-ID;
 //  $picture =$row-PICTURE;
 //  $filetype =$row-FILETYPE;
 //
 //  }
 //
 //
 //
 //  mysql_free_result($result);
 //  mysql_close($db);
 // ?
 //
 //
 // ___
 //
 //
 //
 //
 //
 //
 //
 // - Original Message -
 // From: Beau Lebens [EMAIL PROTECTED]
 // To: 'kachaloo' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 // Sent: Monday, July 02, 2001 1:14 PM
 // Subject: RE: [PHP-DB] Showing an image
 //
 //
 //  what you should actually do is save that script as something like
 //  image.php and then on the page where you want to have
 // text + images, do
 //  something like
 // 
 // 
 //  html
 //  body
 //  img src=image.php?uid=xxx border=0br
 //  I am some text under the image that is grabbed from the DB
 //  /body
 //  /html
 // 
 //  assuming that the image.php page accesses teh DB based on
 // a car called
 // uid'
 //  which represents a key to pull the right image, in this
 // case it is xxx
 // :)
 // 
 //  HTH
 //  Beau