How to store a picture in database?

Results 1 to 3 of 3

Thread: How to store a picture in database?

  1. #1
    Join Date
    Dec 1969
    Posts
    119

    Default How to store a picture in database?

    I want to create employee database with their photographs. Please let me know how I can store the .jpg or .bmp image in the database and how to retrieve that?<BR>Thanks<BR>Arvind

  2. #2
    Join Date
    Dec 1969
    Posts
    69

    Default RE: How to store a picture in database?

    The simplest way:<BR>(1) Let&#039s assume your project is in following directory:<BR><BR>E:Inetpubwwwrootmyproject<BR><BR >(2) Let&#039s assume employees&#039 images are in:<BR><BR>E:Inetpubwwwrootmyprojectimages<BR><BR> (3) In database where you keep info about employees beside fields like ID, Surname, Name etc, you will put additional field with path (let&#039s call it PicPath) of his/her picture. Remember, you do not input the WHOLE path only something like this:<BR><BR>images/peter.jpg<BR><BR>Of course, do not use BMP pictures.<BR><BR>(4) In ASP page where you list records of your employees you will have something like this:<BR><BR>&#060;%<BR><BR>&#039 Check if picture for that employee exist<BR>strPic = rs.Fields("PicPath").Value<BR>If strPic = "" Then<BR> &#039 If not use some picture<BR> strPic = "images/notavailable.jpg"<BR>End If<BR><BR>&#037;&#062;<BR>&#060;img src = "&#060;% response.write strPic &#037;&#062;" border ="0"><BR><BR><BR>Hope this was of some help.<BR>stevang@mail.com<BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    119

    Default RE: How to store a picture in database?

    Thank you Goran, thank you very much.<BR>Arvind

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •