Skip to main content

Binary Image

  • 2 minutes to read

The ASPxBinaryImage control is an editor that displays images from a binary stream.

ASPxBinaryImage

The ASPxBinaryImage.ContentBytes property allows you to get editor content as an array of bytes. The ASPxBinaryImage.StoreContentBytesInViewState property allows you to control whether or not editor content is stored within the editor’s view state between postbacks.

Tip

The ASPxBinaryImage control supports the IIS clustered web environment (also known as a Web Farm or Web Garden). See the following help topic to learn more: Binary Storage Configuration.

Image Upload

When the BinaryImageEditingSettings.Enabled property is set to true, users can click the Open Dialog button to upload an image to the control.

BinaryImage - Open Dialog Button

When the drag-and-drop feature is enabled (the BinaryImageEditingSettings.AllowDropOnPreview property is set to true), users can drop images onto the image area to upload them.

BinaryImage_DragAndDrop

The following code sample demonstrates how to save an uploaded image’s bytes on the server side.

protected void ASPxButton1_Click(object sender, EventArgs e) {
    string fileName = Server.MapPath("~/App_Data/UploadedData/avatar.jpg");
    File.WriteAllBytes(fileName, ASPxBinaryImage1.ContentBytes);
}

Supported Image File Formats

ASPxBinaryImage supports the following image file formats:

  • TIFF (Tagged Image File Format)
  • PNG (Portable Network Graphics)
  • GIF (Graphics Interchange Format)
  • JPEG (Joint Photographic Experts Group)
  • BMP (Windows Bitmap)

Note

Use the ASPxImage control to specify the URL of an image on the server side.

Visual Elements

This section describes visual elements that are displayed in the ASPxBinaryImage control when image upload is enabled (the BinaryImageEditingSettings.Enabled property is set to true).

When an editor value is empty, an image area can display empty value text or an empty value image.

BinaryImage_Empty

Elements

Members

Empty Value Text

BinaryImageEditingSettings.EmptyValueText,

ASPxBinaryImage.EmptyValueTextStyle

Empty Value Image

ASPxBinaryImage.EmptyImage

When the drag-and-drop feature is enabled (the BinaryImageEditingSettings.AllowDropOnPreview property is set to true), users can drop images to the image area to upload them.

BinaryImage_DragAndDrop

Elements

Members

Drop Zone

BinaryImageEditingSettings.DropZoneText,

ASPxBinaryImage.DropZoneStyle

The ASPxBinaryImage control displays a progress bar while an image is being uploaded.

BinaryImage_ProgressBar

Elements Members
Progress Bar ASPxBinaryImage.ProgressBarStyle
Progress Bar Indicator ASPxBinaryImage.ProgressBarIndicatorStyle

When a user uploads an image to a control, it displays the open dialog and delete buttons, which allow users to upload another image or remove the current image.

ASPxBinaryImage

Elements

Members

Button Panel

ASPxBinaryImage.ButtonPanelStyle

Open Dialog Button

ASPxBinaryImage.ButtonStyle,

ASPxBinaryImage.OpenDialogButtonImage

Delete Button

ASPxBinaryImage.ButtonStyle,

ASPxBinaryImage.DeleteButtonImage