Page 1 of 1

PHP Dispalying - Assigning an Image from MySQL

Posted: Thu Feb 27, 2003 5:20 am
by meandrew
Hi All :?:

I am wondering how simple it would be to use a table ID from MySQL and dispaly and image assigned to the ID.

I guess the tricky bit is assigning an identify to the image for the selected ID.

Has anyone got any ideas to how I should approach this?

Andrew

Posted: Thu Feb 27, 2003 7:26 am
by pootergeist
It depends how you save the image really.

Option 1: saves the image as whatever.jpg and add a field in the table that also holds that value. echo that out within an <img src tag and jobs a goodun.

Option 2: save the image without an extension just as the row_id (ie '12') and read the headers through scripting before outputting the file - nice method for unix boxes.

PHP Dispalying - Assigning an Image from MySQL

Posted: Thu Feb 27, 2003 7:37 am
by meandrew
good point... The image can be uploaded manually into its own directory. I guess the what I need to do first is establish the association code for CityID to $CityID.gif this shouldn't be a problem really hopefully I will be posting a solution to my own problem shortly :)

Andrew