QImageControl

This example shows off the QImageControl control. It REQUIRES that GD be installed. Moreover, for QImageControl support with JPEG, PNG and/or GIF images, it requires that GD be installed with those respective graphic file format libraries.

The QImageControl control is capable of scaling image files from anywhere in the filesystem (not just in docroot), and displaying it as a control. The Width and Height properties define the maximum size of the image canvas. While the ScaleImageUp and ScaleCanvasDown properties are flags that act accordingly if the original image size is smaller or ends up being smaller than the canvas defined by Width and Height.

Similar to QImageLabel, a Cache Folder can be specified within the docroot to store rendered images, which will be used in the future if the same image file with the same specifications is rendered again.

Also, a BackColor can be defined for the canvas, itself. An ImageType can also be specified to "convert" the image type to a different type (e.g. JPEG, PNG or GIF).

Finally, note that any of Width, Height and ImageType can all be left blank, which would cause QCubed to make the best educated guesses as to what to set them to at render time.

Note: Notice that QImageControl can be constructed outside of the QForm context, allowing you to call RenderImage($strDestinationFilePath) independently (outside of QForms/QControls), giving a nice, modular class to help with standard image rescaling for image files without the need of QForms (e.g. if you want perform batch or back-end operations to rescale whole directories of images, etc.).