I have seen very good questions and answers
I ASP.NET
So here are some questions.
- How can I do this with ASP?
- Is this process a great overload for a server?
- Can I use an image for watermark rather than plain text? Another example from here is that you have many ideas on the image including adding watermarks to the image. can do.
I think this process takes CPU power ether, on php, asp.net on ether. Therefore, an image cache schema is required for such actions.
Here are some basic codes. In this code you need to change the position of the watermark and the size of the images. A PGG image can be with watermark trampers.
Public Zero MakePhoto (... Parameters ...) {bitmap outputImage = null; Graphics G = Faucet; {// Last image output image = try new bitmap (Outview, Outhete, Pixel format.form 24 BPPRGB); G = Graphics FMIM (output image); G.CompositingMode = CompositingMode.SourceCopy; Rectangle = destter = new rectangular (0, 0, outwidth, outheat); // photo (var basic photo = new bitmap) {g.DrawImage (Basic Photo, Destruct, 0, 0, Basic Photo with, BasicFoto.High, Graphics Unit.Pixel); } G.CompositingMode = CompositingMode.SourceOver; // Use of watermark (var watermark = new bitmap (cWaterMarkPhotoOnDisk)) {rectangle destWaterRect = new rectangle (0, 0, outwidth, outhigh); G.DrawImage (Watermark, Destructured, 0, 0, Outwd, Outhete, Graphics Animate. Pixel); } OutputImage.Save (TheFileNameTosaveIt, ImageFormat.Jpeg); } Hold (exception x) {debug.saort (wrong); ... log your error, and send an error image ....} Finally {if (outputImage! = Zero) outputImage.Dispose (); If (g! = Null) g Dispo (); }}
If you want to handle custom, the above code is standing, but you only change the save line.
Public Zero Process Request (HTTP Reference Reference) {context.Response.ContentType = "image / jpeg"; // You add a cache here. response. Cash Set Experience (Datetime. Now.AddMinutes (200)); Context.Response.Cache.SetMaxAge (new timespan (0, 200, 0)); Context.Response.BufferOutput = false; ..... the above code .... outputImage.Save (context.Response.OutputStream, ImageFormat.Jpeg); ..... Code above .... context.Response.End (); }
Comments
Post a Comment