[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/mambots/editors/mostlyce/jscripts/tiny_mce/imagemanager/Classes/ -> ImageEditor.php (summary)

Image Editor. Editing tools, crop, rotate, scale and save.

Author: $Author$
Version: $Id$
File Size: 445 lines (11 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 1 file
 mambots/editors/mostlyce/jscripts/tiny_mce/imagemanager/Classes/Transform.php

Defines 1 class

ImageEditor:: (15 methods):
  ImageEditor()
  isFileSaved()
  processImage()
  processAction()
  getSaveFileName()
  getDefaultSaveFile()
  getUniqueFilename()
  makeRelative()
  getAction()
  uniqueStr()
  createUnique()
  cleanUp()
  getImageType()
  isGDEditable()
  isGDGIFAble()


Class: ImageEditor  - X-Ref

Handles the basic image editing capbabilities.

ImageEditor($manager)   X-Ref
Create a new ImageEditor instance. Editing requires a
tmp file, which is saved in the current directory where the
image is edited. The tmp file is assigned by md5 hash of the
user IP address. This hashed is used as an ID for cleaning up
the tmp files. In addition, any tmp files older than the
the specified period will be deleted.

param: ImageManager $manager the image manager, we need this

isFileSaved()   X-Ref
Did we save a file?

return: int 1 if the file was saved sucessfully,

processImage()   X-Ref
Process the image, if not action, just display the image.

return: array with image information, empty array if not an image.

processAction($action, $relative, $fullpath)   X-Ref
Process the actions, crop, scale(resize), rotate, flip, and save.
When ever an action is performed, the result is save into a
temporary image file, see createUnique on the filename specs.
It does not return the saved file, alway returning the tmp file.

param: string $action, should be 'crop', 'scale', 'rotate','flip', or 'save'
param: string $relative the relative image filename
param: string $fullpath the fullpath to the image file
return: array with image information

getSaveFileName($type)   X-Ref
Get the file name base on the save name
and the save type.

param: string $type image type, 'jpeg', 'png', or 'gif'
return: string the filename according to save type

getDefaultSaveFile()   X-Ref
Get the default save file name, used by editor.php.

return: string a suggestive filename, this should be unique

getUniqueFilename($relative)   X-Ref
Get a unique filename. If the file exists, the filename
base is appended with an increasing integer.

param: string $relative the relative filename to the base_dir
return: string a unique filename in the current path

makeRelative($pathA, $file)   X-Ref
Specifiy the original relative path, a new filename
and return the new filename with relative path.
i.e. $pathA (-filename) + $file

param: string $pathA the relative file
param: string $file the new filename
return: string relative path with the new filename

getAction()   X-Ref
Get the action GET parameter

return: string action parameter

uniqueStr()   X-Ref
Generate a unique string based on md5(microtime()).
Well not so uniqe, as it is limited to 6 characters

return: string unique string.

createUnique($file)   X-Ref
Create unique tmp image file name.
The filename is based on the tmp file prefix
specified in config.inc.php plus
the UID (basically a md5 of the remote IP)
and some random 6 character string.
This function also calls to clean up the tmp files.

param: string $file the fullpath to a file
return: string a unique filename for that path

cleanUp($path,$file)   X-Ref
Delete any tmp image files.

param: string $path the full path

getImageType($file)   X-Ref
Get the image type base on an image file.

param: string $file the full path to the image file.
return: string of either 'gif', 'jpeg', 'png' or 'bmp'

isGDEditable()   X-Ref
Check if the specified image can be edit by GD
mainly to check that GD can read and save GIFs

return: int 0 if it is not a GIF file, 1 is GIF is editable, -1 if not editable.

isGDGIFAble()   X-Ref
Check if GIF can be edit by GD.

return: int 0 if it is not using the GD library, 1 is GIF is editable, -1 if not editable.