faqts : Computers : Databases : MySQL : Tips and Tricks

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

32 of 59 people (54%) answered Yes
Recently 4 of 10 people (40%) answered Yes


I want to store a path to pictures in MySQL. How do i do that - what field type should i use, and how do i "fetch" the picture to the screen?

Sep 28th, 2000 13:30
Narendra Jain, Jan-Borge Landro,

You have to define a column like image_path as a character string of
size minimum 200 (to take care of length path names) in your table.
The populate the database with each picture name (including the path) in
this column. You might have to edit a text file for this purpose or
write a small script to create one.
Later, there is no direct way of showing the picture using MySQL, though
there are programs like Perl, PHP, Java, etc which can display the image
as and when needed.
The commands could be:
create table image_det
  (image_id integer,
   image_desc char(100),
   image_long_desc text,
   image_path char(200)
load from "image.dat"
insert into image_det;
Now use PHP, Perl, Java to display the image with the short and long