PC Review


Reply
Thread Tools Rate Thread

C# Image Processing in ASP

 
 
Martin Schmid
Guest
Posts: n/a
 
      3rd May 2004
Hi... I have this simple Page_Load that works as expected, however, the
output in the browser is such that when one tries to right-click to save the
image, it is grabbing the aspx instead of an actual image... I.e.,
Webform1.aspx calls Results.aspx... when trying to save the image from the
Results.aspx in the browser
Results.aspx, I am getting the client side Webform1.aspx file, as a text
document.


I.e., sending the URL
http://localhost/spc/Result.aspx?fil....jpg&size=0.25
results in the image in the browser window, but when you right-click Save
Picture as.. you don't get a jpeg, you get an aspx text file.

This is my Result.aspx
<%@ Page language="c#" Codebehind="Result.aspx.cs" AutoEventWireup="false"

Below is the code...

Any ideas?



private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
string path=
Request.QueryString.GetValues("file").GetValue(0).ToString();
double size =
Convert.ToDouble(Request.QueryString.GetValues("size").GetValue(0).ToString(
));

string fName = path.Substring(0,path.Length-7) + ".jpg";

System.Drawing.Image fullSizeImg;
System.Drawing.Bitmap bmp;
System.Drawing.Graphics g;
fullSizeImg=System.Drawing.Image.FromFile(Server.MapPath(fName));
Response.ContentType="image/jpeg";
bmp=new System.Drawing.Bitmap(1,1);
g=System.Drawing.Graphics.FromImage(fullSizeImg);
bmp=(System.Drawing.Bitmap)fullSizeImg;
int height = (int)(fullSizeImg.Height*size);

int width = (int)(fullSizeImg.Width*size);

bmp=(System.Drawing.Bitmap)(ResizeImage(bmp,width,height));
bmp.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
g.Dispose();
bmp.Dispose();
}


--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE



--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Document Image Processing (DIP) - changing image file names ALcom Microsoft Word Document Management 0 10th Mar 2006 12:47 PM
Document Image Processing (DIP) - changing image file names ALcom Microsoft Outlook Fax 0 10th Mar 2006 12:40 PM
Image Processing RicercatoreSbadato Microsoft C# .NET 1 6th Jul 2005 04:31 PM
Image processing =?Utf-8?B?QW50b25pbyBHw7NtZXo=?= Microsoft VC .NET 2 22nd Jul 2004 04:32 PM
Image processing oeyvind toft Microsoft Dot NET Framework Forms 2 25th Jul 2003 10:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:39 AM.