This example shows off the QImageControl
control. It REQUIRES
that GD be installed. Moreover, for QImageControl
with JPEG, PNG and/or GIF images, it requires that GD be installed with
those respective graphic file format libraries.
control is capable of scaling image files from anywhere in the filesystem (not just in docroot), and displaying it as a control.
properties define the maximum size of the image canvas. While the ScaleImageUp
properties are flags that act accordingly if the original image size is smaller or ends up being smaller than the
canvas defined by Width
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
can all be left blank, which would cause Qcodo to
make the best educated guesses as to what to set them to at render time.
Notice that QImageControl
can be constructed outside of the QForm context, allowing you to call
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.).