Ticket T645547
Visible to All Users

Using ImageEdit to save an Image with a specific path to a different folder

created 7 years ago

I want to allow people to put an image in an ImageEdit control for a specific View, and when they save changes to the view, it saves the image in a specific folder and with a new filename and path, so that we can access it in a report for an image later.  I am storing the path in a database.  I am not sure how to go about this though.

Answers approved by DevExpress Support

created 7 years ago

Hello,
Please accept my apologies for the delayed response.
ImageEdit allows users to load and save images without coding. You can click this editor to invoke FileDialog to select an image from a disk. Or, invoke a toolbar by moving the mouse cursor over this editor and click the Open button. Please see the ImageEdit help topic where this toolbar is demonstrated.
You can save the image to another place using the same toolbar. From what I gather, you want to do it in code so that all images are stored in a specific folder. For this, write the Source's stream to a FileStream and save it to the specific directory:

C#
BitmapImage img = (BitmapImage)imageEdit.Source; MemoryStream str = (MemoryStream)img.StreamSource; FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate); str.WriteTo(fs); fs.Close();

Please consider this approach and let me know whether it satisfies your requirements.

I look forward to your reply.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.