Child pages
  • JSImage

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Div
styledisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Div
iddescription



HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
JSImage
Table Cell (td)
flip(type)
Flips the image verticaly (type param=0) or horizontaly (type param=1).
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
getContentType()
Gets the contenttype (image/jpeg) of this image.
Table Row (tr)
Table Cell (td)
byte[]
Table Cell (td)
getData()
Gets the bytes of this image, so that they can be saved to disk or stored the database.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
getHeight()
Gets the height of this image.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
getMetaDataDescription(property)
Gets the description of a metadata property from the image.
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
getMetaDataObject(property)
Gets the real object of a metadata property from the image.
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
getMetaDataProperties()
Gets the available metadata properties from the image.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
getWidth()
Gets the width of this image.
Table Row (tr)
Table Cell (td)
JSImage
Table Cell (td)
resize(width, height)
Resizes the image to the width/height given, keeping aspect ratio.
Table Row (tr)
Table Cell (td)
JSImage
Table Cell (td)
rotate(degrees)
Rotates the image the number of degrees that is given.



HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idflip-Number
Table Row (tr)
idname
Table Cell (td)

flip

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSImage
Span
stylefont-weight: bold;
flip
Span
(type)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Flips the image verticaly (type param=0) or horizontaly (type param=1). A new JSImage is returned.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} type
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSImage
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file_or_filename);//loads the image
image = image.flip(0);//flip vertically
var bytes = image.getData();//gets the image bytes
plugins.file.writeFile('filename',bytes);//saves the image bytes
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetContentType
Table Row (tr)
idname
Table Cell (td)

getContentType

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getContentType
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the contenttype (image/jpeg) of this image.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file);
var width = image.getWidth();
var height = image.getHeight();
var contentType = image.getContentType();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetData
Table Row (tr)
idname
Table Cell (td)

getData

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
byte[]
Span
stylefont-weight: bold;
getData
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the bytes of this image, so that they can be saved to disk or stored the database.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
byte[]
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file_or_filename);//loads the image
image = image.resize(200,200);//resizes it to 200,200
var bytes = image.getData();//gets the image bytes
plugins.file.writeFile('filename',bytes);//saves the image bytes
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetHeight
Table Row (tr)
idname
Table Cell (td)

getHeight

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getHeight
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the height of this image.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file);
var width = image.getWidth();
var height = image.getHeight();
var contentType = image.getContentType();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetMetaDataDescription-String
Table Row (tr)
idname
Table Cell (td)

getMetaDataDescription

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getMetaDataDescription
Span
(property)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the description of a metadata property from the image. Currently only jpg is supported.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} property
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file_or_filename);//loads the image
// get the available metadata properties from the image, currently only jpg is supported
var propertiesArray = image.getMetaDataProperties();
for(var i=0;i<propertiesArray.length;i++)
{
	var property = propertiesArray[i]
	application.output("property: " + property);
	application.output("description (string): " + image.getMetaDataDescription(property))
	application.output("real object: " + image.getMetaDataObject(property))
}
// Thumbnail data is stored under property 'Exif - Thumbnail Data', extract that and set it in a dataprovider
thumbnail = image.getMetaDataObject("Exif - Thumbnail Data"); // gets thumbnail data from the image
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetMetaDataObject-String
Table Row (tr)
idname
Table Cell (td)

getMetaDataObject

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
getMetaDataObject
Span
(property)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the real object of a metadata property from the image. Currently only jpg is supported.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} property
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Object
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file_or_filename);//loads the image
// get the available metadata properties from the image, currently only jpg is supported
var propertiesArray = image.getMetaDataProperties();
for(var i=0;i<propertiesArray.length;i++)
{
	var property = propertiesArray[i]
	application.output("property: " + property);
	application.output("description (string): " + image.getMetaDataDescription(property))
	application.output("real object: " + image.getMetaDataObject(property))
}
// Thumbnail data is stored under property 'Exif - Thumbnail Data', extract that and set it in a dataprovider
thumbnail = image.getMetaDataObject("Exif - Thumbnail Data"); // gets thumbnail data from the image
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetMetaDataProperties
Table Row (tr)
idname
Table Cell (td)

getMetaDataProperties

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String[]
Span
stylefont-weight: bold;
getMetaDataProperties
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the available metadata properties from the image. Currently only jpg is supported.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String[]
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file_or_filename);//loads the image
// get the available metadata properties from the image, currently only jpg is supported
var propertiesArray = image.getMetaDataProperties();
for(var i=0;i<propertiesArray.length;i++)
{
	var property = propertiesArray[i]
	application.output("property: " + property);
	application.output("description (string): " + image.getMetaDataDescription(property))
	application.output("real object: " + image.getMetaDataObject(property))
}
// Thumbnail data is stored under property 'Exif - Thumbnail Data', extract that and set it in a dataprovider
thumbnail = image.getMetaDataObject("Exif - Thumbnail Data"); // gets thumbnail data from the image
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetWidth
Table Row (tr)
idname
Table Cell (td)

getWidth

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getWidth
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the width of this image.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file);
var width = image.getWidth();
var height = image.getHeight();
var contentType = image.getContentType();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idresize-Number_Number
Table Row (tr)
idname
Table Cell (td)

resize

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSImage
Span
stylefont-weight: bold;
resize
Span
(width, height)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Resizes the image to the width/height given, keeping aspect ratio. A new JSImage is returned.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} width
{Number} height
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSImage
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file_or_filename);//loads the image
image = image.resize(200,200);//resizes it to 200,200
var bytes = image.getData();//gets the image bytes
plugins.file.writeFile('filename',bytes);//saves the image bytes
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idrotate-Number
Table Row (tr)
idname
Table Cell (td)

rotate

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSImage
Span
stylefont-weight: bold;
rotate
Span
(degrees)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Rotates the image the number of degrees that is given. A new JSImage is returned.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Number} degrees
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSImage
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var image = plugins.images.getImage(byteArray_or_file_or_filename);//loads the image
image = image.rotate(90);//rotate the image 90 degrees
var bytes = image.getData();//gets the image bytes
plugins.file.writeFile('filename',bytes);//saves the image bytes
Table Row (tr)
classlastDetailRow
Table Cell (td)