Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • My source images are stored in server file system. I need to get the image and treak them on client side. So, I tried to use AspxBinaryImage controls. To get the image data, I need to
                                    1. OPEN image files to a FileStream: FileStream fs = new FileStream(@"c:\file.jpg", FileMode.Open); and
                                    2. READ FileStream to an Array Byte[]: fs.Read(ImageData,0,System.Convert.ToInt32(fs.Length)); and
                                    3. SET: AspxBinaryImage.ContentBytes=ImageData;

                                    Is this a correct way to load image data from a file to AspxBinaryImage? Is there a built-in property available to load from file, such as: AspxBinaryImage.ImageURL="c:\file.jpg" ?

                                    I also wonder the difference between AspxBinaryImage.ContentBytes and AspxBinaryImage.Value. Could you give me an example how to use them?

                                    Thanks,

                                0

                                Hello F G,

                                The ASPxBinaryImage shows images get from binary data. If your file exists in the file system, you probably can use the ASPxImage, where you should simply define and display an image URL.

                                > I also wonder the difference between AspxBinaryImage.ContentBytes and AspxBinaryImage.Value.
                                The ASPxBinaryImage.ContentBytes and Value are the same. Actually the ASPxBinaryImage.ContentBytes is of Byte[] type, and the Value is Object.

                                The example with the ASPxBinaryImage is also available in our Code Central: How to bind the ASPxBinaryImage to a field which contains image data stored as OLE object.

                                Thanks,
                                Vest

                                0

                                Thank you for your example!

                                As I stated on my question, I need to get the image and treak them on client side. I'v tried AspxImage control. It is easy to load image from file, however, it is impossible to get image data from it and treak the image. Also, if I open and treak an image, I have to save it to server's hard disk before to show the image in AspxImage. That is a round-trip through I/O. That is why I want to try AspxBinaryImage.

                                >>The ASPxBinaryImage.ContentBytes and Value are the same.
                                How about its client side function GetValue()? does it return a Byte[] type data? Similar question about SetValue(object), is "object" must an array Byte[]?

                                Thanks,

                                0

                                F G,

                                The ASPxClientBinary image returns nothing when you use the client-side GetValue method. It doesn't return the array of bytes either. If you wish to store bytes somewhere else, you can put them to the ASPxHiddenField directly, and then use it in your code. All image processing (like defining the ContentBytes property) should be performed via the server-side code.

                                Thanks,
                                Vest

                                0

                                OK. I will try HiddenField.

                                How about SetValue()? I know I can show an image at client side by AspxImage.SetValue(localFilePath) or AspxImage.SetImageUrl(localFilePath). Does AspxBinaryImage has similar function to show an image stored on client side, either by file path or binary data?

                                Thanks,

                                0

                                Hello F G,

                                The ASPxBinaryImage stores images in different modes: ASPxBinaryImage.BinaryStorageMode. Unfortunately there isn't a way to get an array of bytes at the client side. I'm sorry. As well as it is impossible to assign the array of bytes to the ASPxBinaryImage at the client side.

                                Thanks,
                                Vest

                                0

                                Thanks.

                                Conclusion:
                                ASPxBinaryImage control can NOT display client side image, and no way to manipulate image at client side.

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners