Example #1
0
        public ActionResult ConsignNowUploadImage(HttpPostedFileBase fileData, string tmpID)
        {
            if (fileData == null)
            {
                return(Content("error"));
            }
            string path = ImageRepository.GetTempImagePath(tmpID);

            System.Drawing.Image img = System.Drawing.Image.FromStream(fileData.InputStream);
            string prefix            = string.Format("{0}{1}{2}", Path.GetFileNameWithoutExtension(fileData.FileName), DateTime.Now.Ticks, Path.GetExtension(fileData.FileName));

            img.Save(Path.Combine(path, "sf_" + prefix), System.Drawing.Imaging.ImageFormat.Jpeg);
            System.Drawing.Image imgThumb = ImageRepository.ChangeImageSize(img, Consts.AuctionImageThumbnailSize, true);
            img.Dispose();
            imgThumb.Save(Path.Combine(path, "thmb_" + prefix), System.Drawing.Imaging.ImageFormat.Jpeg);
            imgThumb.Dispose();
            return(Content("ok"));
        }