I have looked into a bit of this and can find no easy way to do it.
My thought was that I could override the save command (which i did) and then pass the image.bitmap as a property into a instance of the RadUploader and have that deal with the file delivery however this appears much harder than I expected.
Is there any sample code on how to save the result of an ImageEditorUI to server?
or how to convert the result into a RadUploadItem which i could then add to the items collection of a RadUploader and send?
6 Answers, 1 is accepted
You can obtain a reference to the Image previewed in RadImageEditor using the Image property. Then, you can use a format provider such as PngFormatProvider in order to encode the image to a stream or byte array.
After that, you can either use a WCF service or RadUpload in order to save the image on the server.
Please find attached a demo of RadImageEditor and RadUpload. You can refer to this article for information about the server configurations for RadUpload.
Iva Toteva
the Telerik team
this is strange as i need it to be able to accept any sized image, so why does it crash if the picture is over a set size? i assume this is related to PngFormatProvider?
Actually the problem is in our RadZipLibrary which is used with the PngFormatProvider. The bug is known and is logged here so you can track and vote for it.
Kind regards,Viktor Tsvetkov
the Telerik team
so is there some type of work around? can i export my image as jpg, bmp, something? if not how can i convert a radbitmap to a Image so that i can then use an external library to export this file?
The problem is with PngFormatProvider only, as it is the only one using the zip.
You can use BmpFormatProvider to export the image to bmp using analogical code to the one in the sample project. You just have to replace PngFormatProvider with BmpFormatProvider and change the extension of the image file. I tested how bmp export with the image you have attached and the image was successfully saved.
When it comes to JPEG, our JpegFormatProvider supports only import, but you can implement the export yourself, as described in this blogpost. There is also an attached sample project illustrating the implementation of JPEG format provider that allows export using FJ Core. The only thing that you would need to do to get it working with 2012 Q1 is to add the following property to the CustomJpegFormatProvider class:
public
string
FilesDescription
{
get
{
return
SupportedExtensions.First().Trim(
'.'
).ToUpper() +
" Files"
;
}
}
I hope this helps. All the best,
Iva Toteva
the Telerik team