Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Image Loading in ASP.NET

Posted on 2003-11-01
6
Medium Priority
?
255 Views
Last Modified: 2010-04-17
The way I Load images read from a database is first reading the image as binary stream and eventually Response.BinaryWrite to a page and then load the page as the image src of the aspx page.

Is there a more efficient way of loading images rather first loading to a page and then laoding the page ?
0
Comment
Question by:Anurudda
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 

Accepted Solution

by:
sberkovitz earned 272 total points
ID: 9664134
byte[] imageBytes = GetImageDataFromSomewhere();

Response.ContentType = "image/jpeg" // or whatever type the image is
Response.OutputStream.Write(imageBytes, 0, imageBytes.Length);
Response.End();

0
 
LVL 1

Assisted Solution

by:net99online
net99online earned 268 total points
ID: 9667401
You Can get your image directly using Image datatype
you must first include the namespace which include the Image class

1-from the Data Toolbox make a SQLCommand and put in it the select statment

2-in its parameters define the image parameter let it "@image_par" and for its SqlDbType choose the "Image" Datatype

3- change the dirction property to "Output"

4-excute the procedure, this must be done before you get the value

5-you can get the image Like This :

Image img = (image) sqlCommand1.parameters["@image_par"]
note: the image must be stored in bitmap format

please inform me for any questions
0
 
LVL 1

Expert Comment

by:net99online
ID: 9667416
please add this step

in the parameter you add be sure to type in the SourceColoumn property the Column in the database which includes the image data
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question