473,395 Members | 1,653 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,395 software developers and data experts.

Auto Expand Images

I currently use the below code to display images from my database. Part of
what my site allows is for users to click on an image and I open up my
handler.ashx to display the image. Is there a way to make the image always
be displayed in full size? Users of my site dont realize that you can
either click the image to make it go full size or click the icon in the
lower right part of the image when you mouse over it to expand it.

TIA
public class Handler : IHttpHandler {

public bool IsReusable {

get {

return true;

}

}
public void ProcessRequest (HttpContext context) {

// Set up the response settings

context.Response.ContentType = "image/jpeg";

context.Response.Cache.SetCacheability(HttpCacheab ility.Public);

context.Response.BufferOutput = false;

// Setup the Size Parameter

// Setup the PhotoID Parameter

Int32 id = -1;

Stream stream = null;

string originalsize = "O";

if(context.Request.QueryString["Size"] != null &&
context.Request.QueryString["Size"] != "")

{

originalsize = context.Request.QueryString["Size"];

}
if (context.Request.QueryString["PhotoID"] != null &&
context.Request.QueryString["PhotoID"] != "")

{

id = Convert.ToInt32(context.Request.QueryString["PhotoID"]);

stream = PhotosService.GetPhoto(id, originalsize);

}

else

{

id = Convert.ToInt32(context.Request.QueryString["ProductID"]);

stream = PhotosService.GetFirstPhoto(id,
Convert.ToInt32(context.Request.QueryString["CompanyID"]), originalsize);

}

// Get the photo from the database, if nothing is returned, get the default
"placeholder" photo

if (stream == null)

{

stream = new
FileStream(HttpContext.Current.Server.MapPath("~/Images/placeholder-200.jpg"),
FileMode.Open, FileAccess.Read, FileShare.Read);

}

// Write image stream to the response stream

const int buffersize = 1024 * 16;

byte[] buffer = new byte[buffersize];

int count = stream.Read(buffer, 0, buffersize);

while (count 0)

{

context.Response.OutputStream.Write(buffer, 0, count);

count = stream.Read(buffer, 0, buffersize);

}
}

}
Aug 12 '07 #1
0 1042

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

Similar topics

2
by: Jim Devenish | last post by:
I have a combo box with Auto Expand and Limit to List both set to 'yes'. When I type 'C' I correctly get: C J Valeting When I type 'CO' I get: Cogent Seating Ltd again correct BUT when I go...
0
by: CJ | last post by:
I have a Crystal Report displaying nicely via asp.net, plus having it convert to pdf via asp.net - but here's the problem: there're certain sections on the report that're hidden and hence expand...
1
by: daniellee2006 | last post by:
I am creating a basic website to store people profiles and within this website i have a page that creates a table dependent on the number of records in mysql written in PHP within these tables...
1
by: pemigh | last post by:
In a prior posting (too old to reply directly), Jim Devenish described exactly what my client has seen, both in terms of AutoExpand behaving oddly and the way that caps lock relates to the...
3
by: Otto de Voogd | last post by:
I posted the problem below in alt.www.webmaster before, but no-one knew the answer, however someone suggested this group as a good place to ask. I am trying to fit images into a browser window...
4
by: magmike | last post by:
I've got a control on my form that allows the user to select a record based on a form field (in this example, the drop down menu shows the company name, followed by the contact name but uses the...
1
by: pravinnweb | last post by:
can anyone tell me how to set auto height to outer div that is in green box id "gray-background" it should increase relatively to inner div "smbox" here is the css and html code it should work in...
2
by: =?Utf-8?B?QW1pciBUb2hpZGk=?= | last post by:
Hi I have a web page that has a TreeView on it. If I DONT'T expand the TreeView nodes, the auto refresh works nicely: my page gets refreshed every minute. As soon as I expand a node on the...
3
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.