using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;

public partial class Admin_DisplayImage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Image photo = null;
        if (Request.QueryString["imgtype"] == "thumbnail")
        {
            if (Request.QueryString["photoid"] != null)
            {
                int photoid = int.Parse(Request.QueryString["photoid"]);
                photo = PhotoHelper.GetThumbnail(photoid);
            }
            if (Request.QueryString["albumid"] != null)
            {
                int albumid= int.Parse(Request.QueryString["albumid"]);
                photo = PhotoHelper.GetThumbnailForAlbum(albumid);
            }
        }
        else
        {
            int photoid = int.Parse(Request.QueryString["photoid"]);
            photo = PhotoHelper.GetPhoto(photoid);
        }
        photo.Save(Response.OutputStream, ImageFormat.Gif);
    }
}
