Ejemplo n.º 1
0
    protected void SaveImage(object sender, EventArgs e)
    {
        if (!CurrentMenuId.HasValue)
        {
            return;
        }

        Menu   menu     = BusinessFacade.Instance.GetMenu(CurrentMenuId.Value);
        string category = "MenusScreenShots";

        string savePath = Server.MapPath(string.Format(@"~\Images\{0}\", category));

        if (!Directory.Exists(savePath))
        {
            Directory.CreateDirectory(savePath);
        }

        string t_strLargeImage = string.Format(@"{0}{1}.jpg", savePath, menu.MenuName);

        // Create instance
        ThumbMakerClass t_xThumbMaker = new ThumbMakerClass();

        t_xThumbMaker.SetURL(string.Format("http://{0}{1}/ScreenShotMenu.aspx?menuId={2}&action=screenshot", Request.Url.Host,
                                           Request.ApplicationPath, CurrentMenuId));
        t_xThumbMaker.SetRegInfo("KRMAXARQW-XTABNYBXW-KMQXRWMKB-BNTQABQTE");
        t_xThumbMaker.StartSnap();

        // Save the image with full size in C#
        bool saveImage = t_xThumbMaker.SaveImage(t_strLargeImage.Replace(@"""", "``"));

        if (saveImage)
        {
            Response.Redirect("ScreenShotMenu.aspx?menuId=" + CurrentMenuId);
        }
    }
Ejemplo n.º 2
0
    protected void SaveImage(object sender, EventArgs e)
    {
        Recipe currRecipe = BusinessFacade.Instance.GetRecipe(RecipeId);
        string category   = "ReciepsScreenShots";

        string savePath = Server.MapPath(string.Format(@"~\Images\{0}\", category));

        if (!Directory.Exists(savePath))
        {
            Directory.CreateDirectory(savePath);
        }

        string t_strLargeImage = string.Format(@"{0}{1}.jpg", savePath, currRecipe.RecipeName);

        // Create instance
        ThumbMakerClass t_xThumbMaker = new ThumbMakerClass();

        t_xThumbMaker.SetURL(string.Format("http://{0}{1}/ScreenShotRecipe.aspx?recipeId={2}&action=screenshot", Request.Url.Host,
                                           Request.ApplicationPath, RecipeId));
        t_xThumbMaker.SetRegInfo("KRMAXARQW-XTABNYBXW-KMQXRWMKB-BNTQABQTE");
        t_xThumbMaker.StartSnap();

        // Save the image with full size in C#
        bool saveImage = t_xThumbMaker.SaveImage(t_strLargeImage);

        if (saveImage)
        {
            Response.Redirect(string.Format("ScreenShotRecipe.aspx?RecipeId={0}", RecipeId));
        }
    }