Class MOXMAN_Media_ImageAlter
Inheritance | MOXMAN_Media_ImageAlter |
---|
This class does basic image manipulation and enables you to batch operations.
Public Methods
Method | Description | Defined By |
---|---|---|
canEdit() | Returns true/false if the specified file can be altered or not. | MOXMAN_Media_ImageAlter |
createThumbnail() | This method creates a thumbnail for the image. It will only scale the image down never up and it will always be proportional. | MOXMAN_Media_ImageAlter |
crop() | Crops the currently loaded image to the specified x, y and width/height. | MOXMAN_Media_ImageAlter |
destroy() | Destroys the internal data to free resources. | MOXMAN_Media_ImageAlter |
flip() | Flips the image by the vertical or horizotal axis. | MOXMAN_Media_ImageAlter |
getAsString() | Returns the image as a string. | MOXMAN_Media_ImageAlter |
load() | Loads the specified file path for manipulation. | MOXMAN_Media_ImageAlter |
loadFromFile() | Loads the specified file instance for manipulation. | MOXMAN_Media_ImageAlter |
resize() | Resizes the image to the specified size. | MOXMAN_Media_ImageAlter |
rotate() | Rotates the image to the specifed angle. The angles are fixes at 90 degrees intervals. | MOXMAN_Media_ImageAlter |
save() | Saves the current image to the specified file. | MOXMAN_Media_ImageAlter |
saveToFile() | Saves the image to the specified file. | MOXMAN_Media_ImageAlter |
Method Details
Returns true/false if the specified file can be altered or not.
public static Boolean canEdit ( MOXMAN_Vfs_IFile $file ) | ||
$file | MOXMAN_Vfs_IFile | File to check if can be altered. |
return | Boolean | True/false if the image can be edited or not. |
---|
This method creates a thumbnail for the image. It will only scale the image down never up and it will always be proportional.
public Boolean createThumbnail ( $width, $height, $mode = "resize" ) | ||
$width | int | Target width. |
$height | int | Target height. |
$mode | ||
return | Boolean | True/false if the scale occured or not. |
---|
Crops the currently loaded image to the specified x, y and width/height.
public void crop ( $x, $y, $width, $height ) | ||
$x | int | X position to start crop from. |
$y | int | Y position to start crop from. |
$width | int | Width to crop by. |
$height | int | Height to crop by. |
Destroys the internal data to free resources.
public void destroy ( ) |
Flips the image by the vertical or horizotal axis.
public void flip ( $horizontal ) | ||
$horizontal | Boolean | Horizontal flip. |
Returns the image as a string.
public string getAsString ( $type, $quality = 90 ) | ||
$type | string | Jpg, gif or png type name, defaults to input type. |
$quality | int | Image quality for jpegs. |
return | string | Image as a string. |
---|
Loads the specified file path for manipulation.
public void load ( $path ) | ||
$path | string | Path of file to load. |
Loads the specified file instance for manipulation.
public void loadFromFile ( MOXMAN_Vfs_IFile $file ) | ||
$file | string | File instance to load. |
Resizes the image to the specified size.
public void resize ( $width, $height, $proportional = false ) | ||
$width | int | Width to scale the image to. |
$height | int | Height to scale the image to. |
$proportional |
Rotates the image to the specifed angle. The angles are fixes at 90 degrees intervals.
public void rotate ( $angle ) | ||
$angle | int | Angle to rotate the image to. |
Saves the current image to the specified file.
public void save ( $path, $quality = 90 ) | ||
$path | \stirng | Path of file to save to. |
$quality | int | Image quality for jpegs. |
Saves the image to the specified file.
public void saveToFile ( MOXMAN_Vfs_IFile $file, $quality = 90 ) | ||
$file | \stirng | File instance to save image to. |
$quality | int | Image quality for jpegs. |