示例#1
0
        private static bool Thumbnail(HttpContext context)
        {
            Parameters p = Parameters.Deserialize(context.Request.Params["t"]);

            if (!Utils.CheckTimeKey(p["Key", "?"]))
            {
                return(false);
            }
            long id = p.Get("Id", -1L);

            if (id < 0L)
            {
                return(false);
            }
            PaletteManager mgr = new PaletteManager(Utils.ConnectionString);

            byte[] image = mgr.GetPaletteThumbnail((int)id);
            if (image == null)
            {
                handler.SendBytes(context, "image/gif", handler.emptyGif);
            }
            else
            {
                handler.SendBytes(context, "image/jpeg", image);
            }
            image = null;
            return(true);
        }