All source code in ASP/ VbScript Ask a ASP/ VbScript Pro Discussion Forum Categories All jobs in ASP/ VbScript
Quick Search for:  in language:    
image,from,database,display,screen
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 281,486. lines
 Jobs: 101. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login

NEW! LEARNING CENTER
Special educational offers, white papers, webcasts, podcasts

  NEW! Download Rational Performance Tester V8 (download now)
  NEW! Download Rational Functional Tester V8 (download now)
  NEW! Download Rational Service Tester for SOA Quality V8 (download now)
  NEW! Teleconference: Quality In Action - Using Rational Quality Manager with Functional, Performance and Web Service Testing Products (download now)
  NEW! Introducing IBM Rational AppScan Developer Edition – easing security testing by non-security professionals (download now)

 

 


Latest postings for ASP/ VbScript.
Click here to see a screenshot of this code!Mess Officer Management System (Sistem Pengurusan Mess Pegawai)
By Mohd Fauzi on 11/23

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

PULLING IMAGES FROM ACCESS DB

Print
Email
 
VB icon
Submitted on: 3/25/2000
By: MUKUNTHAN 
Level: Intermediate
User Rating: By 3 Users
Compatibility:ASP (Active Server Pages)

Users have accessed this code 22079 times.
 
 
     You can get the image from database and can display in the screen
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: PULLING IMAGES FROM ACCESS DB
    ' Description:You can get the image from
    '     database and can display in the screen
    ' By: MUKUNTHAN
    '
    ' Inputs:Database must have to contain t
    '     he image.
    '
    ' Returns:Returns image and can display 
    '     the corresponding record
    '
    ' Side Effects:ASP
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=6108&lngWId=4    'for details.    '**************************************
    
    <HTML>
    <HEAD>
    <TITLE>Getting Employee Info</TITLE>
    </HEAD>
    <BODY>
    <H1>Employee Info</H1>
    <FORM method="post" action="GetEmpInfo.asp">
    Enter the last name of the employee you want To search:
    <BR><INPUT type=text name="empLastName" size=40 value=<%=Request("empLastName")%> > 
    <INPUT type=submit style="width=150" value="Show">
    </FORM>
    <HR>
    <span>Sample names are: <I>Davolio, Fuller, Buchanan</I></span>
    <HR><BR>
    <% 
    if Request("empLastName") = "" Then Response.End
    %>
    <% 
    sql1 = "select firstname, lastname, city, hiredate, photo from Employees where "
    sql2 = "lastname='"
    sql3 = Request.Form("empLastName") & "'"
    sql = sql1 & sql2 & sql3
    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.CursorLocation = 3
    oRS.Open sql, "DSN=NW"
    SetImageForDisplay oRS("photo"), "ole"
    'oRS.Open "select logo from pub_info whe
    '     re pub_id='0736'", "DSN=PUBS;UID=sa" 
    'SetImageForDisplay oRS("logo"), "gif"
    Set oRS.ActiveConnection = Nothing
    %>
    <TABLE>
    <TR>
    <TD valign=top><B>Employee:</B><BR>
    <%=oRS("firstName") %> <%=oRS("lastName") %><BR>
    <B>from </B> <%=oRS("city") %><BR>
    <B>hired </B> <%=oRS("hiredate") %><BR>
    </TD>
    <TD>
    <Img src="theImg.asp"</Img>
    </TD>
    </TR>
    </TABLE>
    <%
    function SetImageForDisplay(field, contentType)
    OLEHEADERSIZE = 78
    
    contentType = LCase(contentType)
    Select Case contentType
    Case "gif", "jpeg", "bmp"
    contentType = "image/" & contentType
    bytes = field.value 
    Case "ole"
    contentType = "image/bmp" 
    nFieldSize = field.ActualSize
    oleHeader = field.GetChunk(OLEHEADERSIZE)
    bytes = field.GetChunk(nFieldSize - OLEHEADERSIZE)
    End Select
    Session("ImageBytes") = bytes
    Session("ImageType") = contentType
    End function
    %>
    </BODY>
    </HTML>

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
4/15/2000 2:46:35 PMFabrizio Ricciarelli

Hi! I'm interested in this stuff. Your method seems to be interesting but I would like to know how to use the properties
Session("ImageBytes") = bytes to retrieve the image: could the answer be written in one of the following asp pages???

GetEmpInfo.asp ; theImg.asp

If so, may I have , please, these pages trough my e-mail?

Thanks in advance
Fabrizio Ricciarelli
ric@theta.it
(If this comment was disrespectful, please report it.)

 
6/16/2000 10:56:37 PMMaC LOOi

Cool ....
This is the sample I one.
Can I have GetEmpInfo.Asp and theImg.Asp
as weel . Can u send to mu e-mail

yslooi@tm.net.my

Thanks
MaC
(If this comment was disrespectful, please report it.)

 
7/24/2000 5:11:56 PMGeno

This is great... but without theImg.asp we have to guess at what you're doing.
My guess is that you're storing the image data in a session variable and the using a Response.BinaryWrite in theImg.asp to stream the image back to the requesting page.
How about posting a copy of theImg.asp?

Thanks
(If this comment was disrespectful, please report it.)

 
7/24/2000 5:17:41 PMGeno

One more thing... since .BMP's can't be displayed thru a web browser, do you have an algorythm to convert them to GIF's or JPG's??
(If this comment was disrespectful, please report it.)

 
8/23/2000 3:53:57 PMNestor Felippe

Can I have GetEmpInfo.Asp and
theImg.Asp as weel . Can you send to my
e-mail?
nextorfelippe@yahoo.com

(If this comment was disrespectful, please report it.)

 
8/23/2000 3:54:46 PMNestor Felippe

Can I have GetEmpInfo.Asp and
theImg.Asp
as weel . Can you send to my
e-mail

(If this comment was disrespectful, please report it.)

 
9/20/2000 6:34:26 AMJos Krause

Did anyone get the complete code of this article yet? Seems to be a neat piece of code :)
(If this comment was disrespectful, please report it.)

 
12/1/2000 4:35:33 PMEric Gionet

The theImg.asp should have the following code,
<%
response.Expires = 0
response.Buffer = True
response.Clear

response.contentType = Session(
(If this comment was disrespectful, please report it.)

 
8/23/2001 8:33:14 PMDave Rose

Thanks Eric, Jos and Tim for helping out. I've submitted the full code for this that I was referred to and if accepted by planet source will be under the moniker "more on displayin an image with an access database" or something like that! Anyway, people here are way cool. have a good day.
(If this comment was disrespectful, please report it.)

 
2/4/2002 10:23:39 AMVinicius Camara

Great code!
How do I store de image in database?
(If this comment was disrespectful, please report it.)

 
8/22/2002 4:36:00 AMVortexo

Hi there! this is the idea I've been waiting for, but looking at the date,it seems old. Can I gett he complete asps to make it work. I'll really appreciate it. Please send to Vortexo@hotmail.com
(If this comment was disrespectful, please report it.)

 
11/16/2002 4:43:34 AM

I would like to have theImg.asp
file please.
Also does this work in Netscape ?

(If this comment was disrespectful, please report it.)

 
12/20/2002 4:05:01 AM

Can u provide me the complete application.

THANKS
(If this comment was disrespectful, please report it.)

 
3/27/2003 6:32:35 AM

Hi, this code was very helpful. Could you please e-mail GetEmpInfo.asp and
theImg.asp so I can see how these work aswell. Thanks in advance, rich_stephenson@hotmail.com

(If this comment was disrespectful, please report it.)

 
12/23/2004 10:45:52 AM

Could you please e-mail GetEmpInfo.asp
and theImg.asp so I can see how these
work aswell.
(If this comment was disrespectful, please report it.)

 
5/27/2005 6:02:26 PM

Excellent, just what i was looking for. Please send GetEmpInfo.Asp and
theImg.Asp files to jaruesga@gutsa.com.mx.

Thanks
(If this comment was disrespectful, please report it.)

 
5/27/2005 6:03:51 PM

Just what i was looking for. Please send the GetEmpInfo.Asp and theImg.Asp
to e-mail at jaruesga@gutsa.com.mx. Thanks
(If this comment was disrespectful, please report it.)

 
8/3/2005 2:17:29 AMkaleemullah

this is what i was looking for,
would you plz send me theimage.asp and GetEmpInfo.Asp and also tell me how could i send image to table using insert query, and through asp, thankx
(If this comment was disrespectful, please report it.)

 
4/11/2007 10:26:22 AMJuan Jalil

nice work, i need to implement it in asp.net, could anybody please send me the GetEmpInfo.asp and theImg.asp files to juanogcx@hotmail.com. Thanks in advance
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2008 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.