GraphicImage Template
make()
Load an image from a file or from a binary object.
Syntax
Boolean = rb.GraphicImage.make(filename, mimeType)
Parameters
The 'make' method takes 2 parameters:
Name | Type/Value | Range/Length | Description | filename | MetaData | | Optional.
Either a string or a binary object. If a string this is the path name within the virtual server
of an image file to open. If a binary object then the contents are used to create the image.
| mimeType | string | | Optional.
The image library must know the type of image being loaded. Use this parameter to specify the
image type. See below for a list of supported types.
|
Results
The 'make' method returns Boolean:
Type/Value | Range/Length | Description |
Boolean |
  |
If successful this function returns 'true'. Serious errors throw an exception.
|
Remarks This method initialises an image object with a specific image. The image is
taken either from the file-system, or from a binary object. In either case it's necessary to tell the system the format of the image to
load. The GraphicImage library uses 'mime-types' to identify image types. The
following types are recognised : - image/jpeg
A JPEG format image. - image/gif
A palette based 256 colour GIF image. - image/png
A PNG format image. - image/gd
An internal uncompressed representation of an image. - image/gd2
An internal uncompressed representation of an image.
Note The internal formats above are private mime-types used
within Whitebeam. The two forms represent the GD libraries internal storage format.
Use of these formats is recommended where an application wishes to load
an image for processing - for example a background image. The benefit of these formats is their fast load time. Internal formats should never be sent to applications. Example
// Create an image object and fill it with a disk image
var image = new GraphicImage
image.make('/images/myimage.jpg','image/jpeg');
// This can be done in one step:
var image2 = (new GraphicImage).make('/images/myimage2.jpg','image/jpeg');
|