Resizing/watermarking an image after upload

2 posts, 1 answers
  1. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 06 Nov 2009 Link to this post

    I love the embedded BinaryImage controls, but I have a situation where I need to do a little bit of processing with an image after the upload.

    Here's the scenario; I have a hierarchical grid; the second tier contains zero or more images related to the master table. What I'd like to do is this; when I insert or replace an image, I'd like to resize the image to an appropriate size for my app, create a thumbnail of the image, and add a watermark image to the larger version. The image manipulation would be done with a third-party control  (I'm using ImgWriter), so basically what I need to do is identify when an image has been uplaoded, get the image out into an object, manipulate it, and then save it back (along with updating another column).

    I'm wondering where I could attach this processing? Also, since the table I want to update is the second-level table, how do I respond only when the second level table is updated?


  2. Answer
    Sebastian avatar
    9934 posts

    Posted 12 Nov 2009 Link to this post

    Hello Derek,

    You can get access to the uploaded file on postback operation using the UploadedFiles collection of the RadUpload editor (part of built-in GridBinaryImageColumn). From there you can manipulate the uploaded image content with your third party tool, apply the changes and then save it in the underlying source blob field.

    You can use the 'First look' online demo of RadListView for reference about how to get and process the uploaded content to a database:

    See the code implementation from the sample for further details. Also keep in mind that the data should be in valid binary array format in order to be saved and recognized later by RadBinaryImage.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
Back to Top