Child pages
  • JSImage

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE


HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
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 Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getContentType()
Gets the contenttype (image/jpeg) of this image.
Table Body (tbody)
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 Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getHeight()
Gets the height of this image.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getMetaDataDescription()
Gets the description of a metadata property from the image.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#getMetaDataObject()
Gets the real object of a metadata property from the image.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getMetaDataProperties()
Gets the available metadata properties from the image.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getWidth()
Gets the width of this image.
Table Body (tbody)
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 Body (tbody)
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
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idflip
classnode
Table Row (tr)
idname
Table Cell (td)
flip
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSImage
Span
stylefloat: left; font-weight: bold;
idiets
flip
Span
stylefloat: left;
idiets
(type)
Table Row (tr)
iddes
Table Cell (td)
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
type
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getContentType
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getContentType
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the contenttype (image/jpeg) of this image.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getData
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
byte[]
Span
stylefloat: left; font-weight: bold;
idiets
getData
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
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
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
classnode
Table Row (tr)
idname
Table Cell (td)
getHeight
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getHeight
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the height of this image.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getMetaDataDescription
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getMetaDataDescription
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the description of a metadata property from the image. Currently only jpg is supported.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getMetaDataObject
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object
Span
stylefloat: left; font-weight: bold;
idiets
getMetaDataObject
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the real object of a metadata property from the image. Currently only jpg is supported.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getMetaDataProperties
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getMetaDataProperties
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the available metadata properties from the image. Currently only jpg is supported.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
getWidth
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getWidth
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Gets the width of this image.
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
resize
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSImage
Span
stylefloat: left; font-weight: bold;
idiets
resize
Span
stylefloat: left;
idiets
(width, height)
Table Row (tr)
iddes
Table Cell (td)
Resizes the image to the width/height given, keeping aspect ratio. A new JSImage is returned.
Table Row (tr)
idprs
Table Cell (td)
Parameters
width
height
Table Row (tr)
idret
Table Cell (td)
Returns
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
classnode
Table Row (tr)
idname
Table Cell (td)
rotate
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSImage
Span
stylefloat: left; font-weight: bold;
idiets
rotate
Span
stylefloat: left;
idiets
(degrees)
Table Row (tr)
iddes
Table Cell (td)
Rotates the image the number of degrees that is given. A new JSImage is returned.
Table Row (tr)
idprs
Table Cell (td)
Parameters
degrees
Table Row (tr)
idret
Table Cell (td)
Returns
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)