-3

すべてが行われたスライダーで画像のリストを表示しているビューがありますが、ユーザーが2つの画像を選択したときにコントローラーが画像を互いにマージし、両方の画像にテキストを実装する必要がある場合にコーディングしたい.Jqueryで可能ですか両方のdivをコピーして画像に変換し、コントローラーに送信します。

任意の例 C# Jquery 教えてください

 [HttpPost]
        public ActionResult Index(HttpPostedFileBase Imageone, HttpPostedFileBase Imagetwo)
        {



            return View();
        }

  public static System.IO.MemoryStream CombineImages(byte[] imageBytes1, byte[] imageBytes2)
        {
            if ((imageBytes1 == null || imageBytes1.Length == 0) ||
                (imageBytes2 == null || imageBytes2.Length == 0))
                return null;

            //convert bytes to Image
            var image1 = System.Drawing.Image.FromStream(new System.IO.MemoryStream(imageBytes1));
            var image2 = System.Drawing.Image.FromStream(new System.IO.MemoryStream(imageBytes2));

            //create the Bitmap object
            var bitmap = new System.Drawing.Bitmap(image1.Width, image1.Height, PixelFormat.Format32bppPArgb);
            //create the Graphics object
            var g = System.Drawing.Graphics.FromImage(bitmap);

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
            g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

            g.DrawImage(image1, 0, 0);

            g.DrawImage(image2, 0, 0);

            var ms = new System.IO.MemoryStream(bitmap.Width * bitmap.Height);

            bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

            return ms;

        }
4

1 に答える 1

1

ページにある画像がサーバー上にあると仮定すると、両方の div をコピーする必要はありません。ユーザーに 2 つの画像を要求し、ファイル パスを json としてアップロードして、コントローラー自体とそこから移動します。

于 2013-05-10T10:17:12.200 に答える