473,394 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Image Processing

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., 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.

<%@ Page language="c#" Codebehind="Result.aspx.cs" AutoEventWireup="false"
Inherits="spc.Result" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Result</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
</body>
</HTML>
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("si ze").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.M apPath(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.Imag ing.ImageFormat.Jpeg);
g.Dispose();
bmp.Dispose();
}
--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE
Nov 18 '05 #1
1 1089
I think you have too much in you page.

get rid of everything after the directives page..

In a very similar webform the only lines in my "webpage" ar
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="ReturnFile.aspx.vb" Inherits="albertphoto.ReturnFile"%

HT

Ro

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Deepa | last post by:
Hi All, I'm facing problem displaying image of size 5000X5000 .My window size is smaller than image size so i'm not able to see the complete image.i can use scroll bars to view the image but i...
1
by: jasonshohet | last post by:
I read recently that: "if a before-image was made before an interruption in database processing, you use the before-image dump & simply begin processing again from just before the last...
5
by: Jigar Mehta | last post by:
Hye Friends!!, Happy New Year!! I am Jigar Mehta from India. Currently I am working on a project in which I need to compress some images on the harddisk... I want to make an engine that reads...
2
by: | last post by:
Hi, we are planning to rewrite an extisting C++ image processing application/library in C#. Now several question arouse where I hope you can help me: So far we allocated a block of memory as...
10
by: stonny | last post by:
Hi, I am converting my matlab program into C/C++. I need to change some image processing toolbox functions into C/C++, such as edge detection, mathematical morphology. Is there any place that I...
10
by: Enrique Cruiz | last post by:
Hello all, I am currently implementing a fairly simple algorithm. It scans a grayscale image, and computes a pixel's new value as a function of its original value. Two passes are made, first...
3
by: birensubudhi | last post by:
hey guys,can anyone tell me what is image processing, how to do it using C. IN KSHITIJ 2007 held at IIT kgp a que by INFOSYS is asked, they hav given an image then cut in different orientation...
2
by: Peter Oliphant | last post by:
The Image class allows loading a bitmap from a graphic file. So far I've gotten it to work with JPG and BMP files. What other graphic file formats are supported in this way? Is this fixed based...
5
by: whisk3rs | last post by:
Hello, I have a conceptual question. I need to write a program that will take as input a list of images and then process each image individually (extract useful features from the image) ...
0
by: tavares | last post by:
(Our apologies for cross-posting. We appreciate if you kindly distribute this information by your co- workers and colleagues.) ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.