DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 12 Aug 2007 13:04:35 -0400,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    MikeB


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(HttpCacheability.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);

}


}

}
Date:Sun, 12 Aug 2007 13:04:35 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us