Hello
is it possible to display images on a ASPX without having them on the disk
of the server ?
I have images in a DB and whould like to display them on a web page. writing
them to disk seems very costly.
is it posible to create them in memory and some how give them to the client
to display?
thanks in advance
Yoramo. 5 1630
hi,you can do it just like the following example.
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection mycon = new SqlConnection("your connection string");
mycon.Open();
int liid = int.Parse(Request.QueryString["id"]);
string sqlText = "SELECT img_name, img_data, img_contenttype FROM image1
where id="+liid;
SqlCommand MyCommand = new SqlCommand (sqlText, mycon);
SqlDataReader dr =MyCommand.ExecuteReader();
if(dr.Read())
{
Response.ContentType = (dr["img_contenttype"].ToString());
Response.BinaryWrite((byte[])dr["img_data"]);
}
mycon.Close();
}
hello
Thanks for your replay.
can you show me how whould the aspx file look like for such a code to
work?
Yoramo.
"white sheng" <wh********@untsoft.com.cn> wrote in message
news:ec***************@tk2msftngp13.phx.gbl... hi,you can do it just like the following example.
private void Page_Load(object sender, System.EventArgs e) { SqlConnection mycon = new SqlConnection("your connection string"); mycon.Open();
int liid = int.Parse(Request.QueryString["id"]); string sqlText = "SELECT img_name, img_data, img_contenttype FROM
image1 where id="+liid; SqlCommand MyCommand = new SqlCommand (sqlText, mycon); SqlDataReader dr =MyCommand.ExecuteReader(); if(dr.Read()) { Response.ContentType = (dr["img_contenttype"].ToString()); Response.BinaryWrite((byte[])dr["img_data"]); } mycon.Close(); }
He already did. There is no Template HTML. It simply sends an image. You
include a reference to that page as the URL for an image tag in another
page.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Yoramo" <yoramo@[NOSPAM]hotmail.com> wrote in message
news:#8**************@TK2MSFTNGP10.phx.gbl... hello
Thanks for your replay. can you show me how whould the aspx file look like for such a code to work?
Yoramo.
"white sheng" <wh********@untsoft.com.cn> wrote in message news:ec***************@tk2msftngp13.phx.gbl... hi,you can do it just like the following example.
private void Page_Load(object sender, System.EventArgs e) { SqlConnection mycon = new SqlConnection("your connection string"); mycon.Open();
int liid = int.Parse(Request.QueryString["id"]); string sqlText = "SELECT img_name, img_data, img_contenttype FROM image1 where id="+liid; SqlCommand MyCommand = new SqlCommand (sqlText, mycon); SqlDataReader dr =MyCommand.ExecuteReader(); if(dr.Read()) { Response.ContentType = (dr["img_contenttype"].ToString()); Response.BinaryWrite((byte[])dr["img_data"]); } mycon.Close(); }
Hello Kevin
How does it know to place the image in a specific IMG tag or a Image button?
yoramo
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:u2****************@TK2MSFTNGP11.phx.gbl... He already did. There is no Template HTML. It simply sends an image. You include a reference to that page as the URL for an image tag in another page.
-- HTH, Kevin Spencer .Net Developer Microsoft MVP Big things are made up of lots of little things.
"Yoramo" <yoramo@[NOSPAM]hotmail.com> wrote in message news:#8**************@TK2MSFTNGP10.phx.gbl... hello
Thanks for your replay. can you show me how whould the aspx file look like for such a code
to work?
Yoramo.
"white sheng" <wh********@untsoft.com.cn> wrote in message news:ec***************@tk2msftngp13.phx.gbl... hi,you can do it just like the following example.
private void Page_Load(object sender, System.EventArgs e) { SqlConnection mycon = new SqlConnection("your connection string"); mycon.Open();
int liid = int.Parse(Request.QueryString["id"]); string sqlText = "SELECT img_name, img_data, img_contenttype FROM image1 where id="+liid; SqlCommand MyCommand = new SqlCommand (sqlText, mycon); SqlDataReader dr =MyCommand.ExecuteReader(); if(dr.Read()) { Response.ContentType = (dr["img_contenttype"].ToString()); Response.BinaryWrite((byte[])dr["img_data"]); } mycon.Close(); }
<img src="ImageMaker.aspx">
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Yoramo" <yoramo@[NOSPAM]hotmail.com> wrote in message
news:et**************@TK2MSFTNGP12.phx.gbl... Hello Kevin
How does it know to place the image in a specific IMG tag or a Image
button? yoramo
"Kevin Spencer" <ke***@takempis.com> wrote in message news:u2****************@TK2MSFTNGP11.phx.gbl... He already did. There is no Template HTML. It simply sends an image. You include a reference to that page as the URL for an image tag in another page.
-- HTH, Kevin Spencer .Net Developer Microsoft MVP Big things are made up of lots of little things.
"Yoramo" <yoramo@[NOSPAM]hotmail.com> wrote in message news:#8**************@TK2MSFTNGP10.phx.gbl... hello
Thanks for your replay. can you show me how whould the aspx file look like for such a code to work?
Yoramo.
"white sheng" <wh********@untsoft.com.cn> wrote in message news:ec***************@tk2msftngp13.phx.gbl... > hi,you can do it just like the following example. > > private void Page_Load(object sender, System.EventArgs e) > { > SqlConnection mycon = new SqlConnection("your connection
string"); > mycon.Open(); > > int liid = int.Parse(Request.QueryString["id"]); > string sqlText = "SELECT img_name, img_data, img_contenttype
FROM image1 > where id="+liid; > SqlCommand MyCommand = new SqlCommand (sqlText, mycon); > SqlDataReader dr =MyCommand.ExecuteReader(); > if(dr.Read()) > { > Response.ContentType = (dr["img_contenttype"].ToString()); > Response.BinaryWrite((byte[])dr["img_data"]); > } > mycon.Close(); > } > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Adam J Knight |
last post by:
Hi all,
Just wondering whats everyones prefered method of storing images ?
1) File System
2) Database (SqlServer) (Seems to be easier, but has a performance hit)
Appreciate some insight!!!...
|
by: phil-news-nospam |
last post by:
Why does SVG need a different tag than other images?
IMHO, SVG should be implemented as an image type just like any other image
type, allowing it to work with <img> tags, and ... here is the...
|
by: Xah Lee |
last post by:
The following is a program to generate thumbnail images for a website.
Useful, if you want to do that.
It is used to generate the thumbnails for my “Banners, Damsels, and
Mores” project...
|
by: vila |
last post by:
Hi,
I would like to display digits with a 7-bar display, as in a pocket
calculator.
Any ideas about how to do this?
Francis
|
by: TechnoAtif |
last post by:
Hi..There is again a similar problem..Now i;ve got the option values of list?menu box to show the textbox. If the option value of list is yes then the textbox is to be displayed . Can anyone...
|
by: cs_in_va |
last post by:
I have been reading info on putting images inside vs out side the data
and just using a path name. I want to use the later, but having some
difficulties. Here is what I have. I have a database...
|
by: Tim Streater |
last post by:
The following test page is intended to allow the user to choose an image
file, and then display it. It works as expected in Safari 3.1.1, FF
2.0.0.14 (Mac), and IE7 (XP).
But, it fails in FF...
|
by: rgagarrett |
last post by:
Hi,
I hope this is the correct group for my query, please advise if
there's a more relevant place for me!
I'm using a USB camera (Sentech C83) with Linux and I have some C code
for reading data...
|
by: csihosting |
last post by:
I would like to dispaly some images from a remote site (I have permission) on my asp.net page. The site required authentication. How do I retrieve the images and send the credentials without the user...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
| |