This is a migrated thread and some comments may be shown as answers.

watermark in Radeditor

6 Answers 159 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ahmad Jaber
Top achievements
Rank 1
Ahmad Jaber asked on 16 May 2010, 08:44 PM
Hello
I am using Radeditor , I want to add watermark in uploaded image
I read this thread http://www.telerik.com/community/forums/aspnet-ajax/editor/watermark-in-radeditor.aspx 
but I didn't get the way to add watermark to my uploaded image using imagemanager.

can somebody help on this ?

Regards

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 17 May 2010, 03:04 PM
Hi Ahmad,

Were you able to run the Giving the uploaded files unique names example? All you need to do is to override the StoreFile method of the FileSystemContentProvider class of RadEditor and run the watermark code of one of the provided demos:
Watermark your images with this VB.NET code,
Creating a Watermarked Photograph with GDI+ for .NET
and
Add a watermark to an image in VB .NET.

Please note that RadEditor does not offer this feature out-of-the box and we do not support it.

Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ahmad Jaber
Top achievements
Rank 1
answered on 17 May 2010, 05:11 PM
Hi Rumen
I already checked that links before , I can't merge it with radeditor , if you have real example , please help

Regards
0
Rumen
Telerik team
answered on 18 May 2010, 09:47 AM
Hi Ahmad,

Please, find attached the requested working example which demonstrates how to add a watermark to the uploaded image.

Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ahmad Jaber
Top achievements
Rank 1
answered on 18 May 2010, 06:57 PM
Hi Rumen
There is problem in code , when I upload image , it's add watermark , but it will not upload it and only will keep reviewing it , also when I close the Imagemanager and open it again , the image is still remaining.


Thanks in advanced.
0
Accepted
Rumen
Telerik team
answered on 19 May 2010, 03:30 PM
Hi Ahmad,

Thank you for reporting this issue.

To fix it update the code of the StoreFile function as follows:
public override string StoreFile(UploadedFile file, string path, string name, params string[] arguments)
{
    System.Drawing.Image objImage = System.Drawing.Image.FromStream(file.InputStream);//From File
    int height = objImage.Height;//Actual image width
    int width = objImage.Width;//Actual image height
    System.Drawing.Bitmap bitmapimage = new System.Drawing.Bitmap(objImage, width, height);// create bitmap with same size of Actual image
    System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmapimage);
    //Creates a System.Drawing.Color structure from the four ARGB component
    //(alpha, red, green, and blue) values. Although this method allows a 32-bit value
    // to be passed for each component, the value of each component is limited to 8 bits.

     
    //Adding watermark text on image
    //SolidBrush brush = new SolidBrush(Color.FromArgb(113, 255, 255, 255));
    //g.DrawString("WaterMark sample", new Font("Arial", 18, System.Drawing.FontStyle.Bold), brush, 0, 100);
 
    //Adding watermark icon on the image
    Bitmap logo = new Bitmap(this.Context.Server.MapPath("~/images/WaterMark.jpg"));
    g.DrawImage(logo, new Point(70, 70));
 
    string result = VirtualPathUtility.AppendTrailingSlash(path) + name;
    
    bitmapimage.Save(Context.Server.MapPath(result));
    g.Dispose();
    bitmapimage.Dispose();
 
     
    //string result = base.StoreFile(file, path, newFileName, arguments);
    return result;
}

For your convenience I have attached the modified project.

Kind regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ahmad Jaber
Top achievements
Rank 1
answered on 20 May 2010, 10:13 AM
Thanks , it's working now
Tags
Editor
Asked by
Ahmad Jaber
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Ahmad Jaber
Top achievements
Rank 1
Share this question
or