A
Andreas Zita
Hi
The code below takes an id and return the corresponding image-stream. My
Album-class scans the provided dir for images and tags them with id and
filePath on server. In my current approach the m_album is re-generated each
time a request is made. However I would like it to be generated only once
when first run and then always be available on the server ... any ideas on
how a could speed this thing up?
/Andreas Zita
private void Page_Load(object sender, System.EventArgs e)
{
m_album = new Album(Server.MapPath("Data"));
int id = Int32.Parse(Request.QueryString["id"]);
Item item = m_album.FindItemById(id);
if (item == null)
{
System.Drawing.Image image = System.Drawing.Image.FromFile(item.Path);
Response.ContentType = "image/jpeg";
thumbNail.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg
);
image.Dispose();
}
}
The code below takes an id and return the corresponding image-stream. My
Album-class scans the provided dir for images and tags them with id and
filePath on server. In my current approach the m_album is re-generated each
time a request is made. However I would like it to be generated only once
when first run and then always be available on the server ... any ideas on
how a could speed this thing up?
/Andreas Zita
private void Page_Load(object sender, System.EventArgs e)
{
m_album = new Album(Server.MapPath("Data"));
int id = Int32.Parse(Request.QueryString["id"]);
Item item = m_album.FindItemById(id);
if (item == null)
{
System.Drawing.Image image = System.Drawing.Image.FromFile(item.Path);
Response.ContentType = "image/jpeg";
thumbNail.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg
);
image.Dispose();
}
}