Placing Image File Reference Fields

Description

Alpha Anywhere lets you add images to your database in two ways.

  • Bitmap and JPEG Image fields

    store Windows Bitmap (.BMP) or JPEG (.JPG) images in the database. The images are stored in .FPT memo files.

  • Image File Reference fields

    store the paths and filenames of Windows Bitmap (.BMP) or JPEG (.JPG) images in the database, while the images are stored independently in Windows folders. For many applications this is a more efficient way of storing images, and it can result in much smaller databases.

An image file reference field in a table stores the path and filename of a JPEG (.JPG) or Windows Bitmap (.BMP) image. The field on a form displays the image.

Creating an Image File Reference Field

  1. Display the Table/Sets tab of the Control Panel.

  2. Select the table that will contain the field and select Design > Table Structure.

  3. In the resulting Restructure Table dialog box create a field of type "Image File Reference". Its width automatically defaults to 10 characters.

Placing an Image File Reference Field

  1. Select the image file reference field on the Drag and Drop List.

  2. Drag the field onto the form.

  3. Resize and reposition the field (which will display the image) as Necessary.

Adding an Image to the Table

  1. Put the form into view mode.

  2. Right click the image file reference field and select Change Image Filename.

  3. In the resulting Filename dialog box, optionally enter the path and filename of an image file in the File name field.

  4. Optionally,

    • Click the 'open folder' to select a disk drive and directory in the Look in field.

    • Select the file from the File Names list.

    • Optionally, click the 'heart' icon to save the current folder as the default folder when adding other images.

  5. Select the display mode by clicking Best Fit, Absolute, or Stretch.

    • "Absolute" - does not stretch the image. This option may cause the image to appear as a different size when printed.

    • "Stretch" - stretches the image both horizontally and vertically to cover the form's background. This option may distort the image.

    • "Best fit" - scales the image to the maximum size that will fit on the form background without clipping the image.

  6. Click OK to select the image or Cancel to quit.

Adding Data to an Image File Reference Field with Xbasic

The following script was placed under the OnPush event of a button on a form. The form displays a field named picture, which is an Image File Reference field. The IMAGE_FILENAME_ENCODE() function replaces any part of the file path for which there is an alias.

dim img as C
dim tbl as P
tbl = table.current()
img = ui_get_image_filename()
tbl.enter_begin(.t.)
tbl.picture = image_filename_encode(img)
tbl.enter_end(.t.)
picture.Refresh()

To read the image filename, use:

a5_eval_expression(tbl.picture)

Deleting an Image File Reference

  1. Put the form into view mode.

  2. Right click the image file reference field and select Delete Image Filename.

Viewing the Image Filename

  1. Put the form into view mode.

  2. Right click the image file reference field and select Show Image Filename.

  3. Click OK to continue.

See Also