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

Resizing/watermarking an image after upload

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 06 Nov 2009, 11:09 PM
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?

TIA.


1 Answer, 1 is accepted

Sort by
0
Accepted
Sebastian
Telerik team
answered on 12 Nov 2009, 09:36 AM
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:
http://demos.telerik.com/aspnet-ajax/listview/examples/firstlook/defaultcs.aspx

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,
Sebastian
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.
Tags
Grid
Asked by
Derek
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or