glFusion Wiki

Site Tools


glfusion:development:api:img:functions

IMG_getMediaMetaData

(glFusion v1.1.0)

array IMG_getMediaMetaData( string $filename )

This function will return an array of meta data. This is just a front-end to getID3(). The meta data varies depending on the media type, but the ['mime_type'] element will always be available. return an array of meta data. This is just a front-end to getID3(). The meta data varies depending on the media type, but the ['mime_type'] element will always be available.

Parameters

string $filename The full path to the media file

Return

Array of meta data – The contents of the array vary depending on the media type. The ‘mime_type’ element will always be populated.

IMG_convertImageFormat

(glFusion v1.1.0)

array IMG_convertImageFormat( string $srcImage, string $destImage, string $destFormat, [boolean $deleteOriginal=1] )

Convert an image from one format to another.

Parameters

string $srcImage Full path and filename to source image
string $destImage Full path and filename to destination image
string $destFormat Destination mime type (i.e.; 'image/png')
boolean $deleteOriginal If true, delete srcImage after conversion.

Return

Returns an array:

$rc  Return code (true for success, false for failure).  
$msg  Status Message (only populated when $rc == false).  

Notes

$srcImage and $destImage can be the same path / filename, this will convert the original image in place.

IMG_resizeImage

(glFusion v1.1.0)

array IMG_resizeImage( string $srcImage, string $destImage, int $dImageHeight, int $dImageWidth, [string $mimeType=''], [boolean $deleteSrc=0] )

This will resize an image to the desired $dImageWidth x $dImageHeight resolution. It will always maintain the original image aspect ratio. For example, if your source image is 640×320 and you pass 200×200 it will actually resize the image to 200×150 to maintain the aspect ratio.

Parameters

string $srcImage Full path / filename to src image.
string $destImage Full path / filename to destination image.
string $dImageHeight Number of pixels for the target height resolution.
int $dImageWidth Number of pixels for the target width resolution.
string $mimeType Src image mime type (optional).
boolean $deleteSrc If true, delete the src image upon successful resizing. (optional)

Return

Returns an array:

$rc  Return code (true for success, false for failure).  
$msg  Status Message (only populated when $rc == false).  

Notes

The $mimeType field is optional, if not passed (i.e. blank), IMG_resizeImage() will call IMG_getMediaMetaData() to determine the source image mime type.

The destination image will be the same mime type as the source image.

IMG_rotateImage

(glFusion v1.1.0)

array IMG_rotateImage( string $srcImage, string $direction )

Rotate an image 'right' or 'left' 90 degrees.

Parameters

string $srcImage Full path / filename to image to rotate.
string $direction Direction to rotate (right or left).

Return

Returns an array:

$rc  Return code (true for success, false for failure).  
$msg  Status Message (only populated when $rc == false).  

IMG_watermarkImage

(glFusion v1.1.0)

array IMG_watermarkImage( string $origImage, string $watermarkImage, string $opacity, string $location )

Apply a watermark to an original image

Parameters

string $origImage Full path / filename to image to watermark.
string $watermarkImage Full path / filename to watermark image. Watermark image must be either JPG or PNG format.
string $opacity The percentage of opacity (how dark the watermark image will be).
string $location Location to place watermark on the original image:
* topcenter
* topright
* leftmiddle
* center
* rightmiddle
* bottomleft
* bottomcenter
* bottomright

Return

Returns an array:

$rc  Return code (true for success, false for failure).  
$msg  Status Message (only populated when $rc == false).  
glfusion/development/api/img/functions.txt · Last modified: 2017/04/12 21:15 (external edit)

Page Tools