Whitebeam Object Definition

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Whitebeam Object Definition

Method Description

GraphicImage.make()

Load an image from a file or from a binary object.

Syntax

Boolean = GraphicImage.make(filename, mimeType)

Parameters

The 'GraphicImage.make' method takes 2 parameters:

Name Type/Value Range/Length Description
filenameMetaData  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.
mimeTypestring  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 'GraphicImage.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');
        
Whitebeam release 1.3.36
(loadtime : 11ms)