Upload and resize images

This ImpAKT feature is designed to allow the web developer to easily upload images in their dynamic sites. The advantage of this trigger is the ability to resize the pictures used in the site design. The Upload and Resize Image server behavior must be associated to an insert or an update transaction, and before applying it, there must be a file field in your Dreamweaver page.

This server behavior is accessible from the Application panel, Server Behaviors -> + -> MX Kollection -> File Upload -> Upload and Resize Image.

The user interface has three tabs. Directions about the correct configuration of each one is given below.

 

To set the dialog box options for the first tab, follow the next steps:

  1. In the Form field drop-down menu select one of the current file fields of the form included on your Dreamweaver page.
  2. In the Table column drop-down menu select the database table field where you want to upload the image. You can also select None, which means that the image file name will not be saved in the database.
  3. In the Upload folder text box enter the name of the folder where the images will be uploaded. You can use the Browse button to select a static folder and then you can append to it a dynamic value by using the InterAKT Dynamic Data selector.
  4. The Resize image checkbox enables the option of resizing the uploaded image. When checked, the next three controls are activated.
  5. In the Resize method drop-down menu select one of the five available options:

    · Auto, when both the Width and Height text boxes below this drop-down menu are enabled. Depending on which of the two you fill in, the resize will be made either proportionally or fixed.
    · Proportional - Fit to box, when both the Width and Height text boxes below this drop-down menu are enabled. The image will be resized so as to keep its original aspect ratio, but at the same time fit inside a rectangle having the specified dimensions (the image's longest dimension must be less than the box's shortest dimension).
    · Proportional - Fixed width, when only the Width text box below is enabled. The image height is dynamically calculated, proportionally with the entered width.
    · Proportional - Fixed height, when only the Height text box below is enabled . The image width is dynamically calculated, proportionally with the entered height.
    · Fixed width and height, when both the Width and Height text boxes below this drop-down menu are enabled. The image is resized to the entered dimensions, but the original aspect ratio will be lost.

    Tip
    : Images will be resized only if the one of their dimensions exceeds the specified ones. Otherwise, images will be left at their original dimensions.
  6. In the Width text box, when enabled, enter the number of pixels corresponding to the image width.
  7. In the Height text box, when enabled, enter the number of pixels corresponding to the image height.
  8. The three buttons in the top right corner of the interface offer you the next functionalities:
    · Click OK when you are done configuring the trigger.
    · Click Cancel to exit without applying the new settings.
    · The Help button opens this help page.
    These buttons are common to all three tabs of the Image Upload and Resize trigger interface.
  9. Click on the File tab to continue with configuring the trigger.

 

 

To set the dialog box options for the second tab, follow the next steps:

  1. In the Maximum file size text box enter the maximum size that the uploaded image files can have. The measurement unit is the kilo byte (kB). If the entered size is 0 (zero), then the maximum file size allowed will be the one accepted by the server.

  2. In the Allowed extensions area specify the list of extensions that the image files to be uploaded can have. You can add new ones manually, by using the Plus (+) button:



    The Minus (-) button is used to remove extensions from the grid.

  3. In the File renaming drop-down menu select one of the three available options:
    · Automatic renaming - the file is given a new, unique name (by adding a number at the end, before the file extension).
    · Block upload - the file is not renamed, and the transaction is not executed if a file with the same name exists.
    · Custom renaming - this options enables the last control of this interface, namely the text box below.

    Note:
    If in the first tab, you chose no Table column, the Automatic renaming option is automatically selected and then the drop-down made disabled.
  4. In the Renaming rule text box, when enabled, enter a custom name for the image files, using dynamic values, prefixes and suffixes. No spaces are allowed in the custom name. You can input dynamic data in the corresponding field by using the InterAKT Dynamic Data selector.
    Note:
    If you chose not to save the image name in a transaction field, then the custom name can only contain the available transaction field names (as dynamic values) and a defined extension.
  5. Click on the Advanced tab to continue with configuring the trigger.

 

 

For instructions on completing this interface, see the Advanced tab.

When uploading a new image through an update transaction (e.g. to replace a photo), the program will remove all thumbnails of the previous image. They will be re-created when a page containing the Show thumbnail server behavior is displayed in a browser.