ImageManager
[ class tree: ImageManager ] [ index: ImageManager ] [ all elements ]

Class: ImageEditor

Source Location: /main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageEditor.php

Class Overview


Handles the basic image editing capbabilities.


Author(s):

  • $Author: Wei Zhuo $

Version:

  • $Id: ImageEditor.php 27 2004-04-01 08:31:57Z Wei Zhuo $

Variables

Methods



Class Details

[line 19]
Handles the basic image editing capbabilities.



Tags:

author:  $Author: Wei Zhuo $
version:  $Id: ImageEditor.php 27 2004-04-01 08:31:57Z Wei Zhuo $


[ Top ]


Class Variables

$filesaved =  0

[line 36]


Type:   mixed


[ Top ]

$lapse_time = 900

[line 34]

tmp file storage time.


Type:   mixed


[ Top ]

$manager =

[line 24]

ImageManager instance.


Type:   mixed


[ Top ]

$_uid =

[line 29]

user based on IP address


Type:   mixed


[ Top ]



Class Methods


constructor ImageEditor [line 48]

ImageEditor ImageEditor( ImageManager $manager)

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.




Parameters:

ImageManager   $manager   the image manager, we need this for some file and path handling functions.

[ Top ]

method cleanUp [line 481]

void cleanUp( string $path, $file)

Delete any tmp image files.



Parameters:

string   $path   the full path where the clean should take place.
   $file  

[ Top ]

method createUnique [line 457]

string createUnique( string $file)

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.




Tags:

return:  a unique filename for that path NOTE: it only returns the filename, path no included.


Parameters:

string   $file   the fullpath to a file

[ Top ]

method getAction [line 428]

string getAction( )

Get the action GET parameter



Tags:

return:  action parameter


[ Top ]

method getDefaultSaveFile [line 359]

string getDefaultSaveFile( )

Get the default save file name, used by editor.php.



Tags:

return:  a suggestive filename, this should be unique


[ Top ]

method getImageType [line 519]

string getImageType( string $file)

Get the image type base on an image file.



Tags:

return:  of either 'gif', 'jpeg', 'png' or 'bmp' otherwise it will return null.


Parameters:

string   $file   the full path to the image file.

[ Top ]

method getSaveFileName [line 333]

string getSaveFileName( string $type)

Get the file name base on the save name and the save type.



Tags:

return:  the filename according to save type


Parameters:

string   $type   image type, 'jpeg', 'png', or 'gif'

[ Top ]

method getUniqueFilename [line 375]

string getUniqueFilename( string $relative)

Get a unique filename. If the file exists, the filename base is appended with an increasing integer.



Tags:

return:  a unique filename in the current path


Parameters:

string   $relative   the relative filename to the base_dir

[ Top ]

method isFileSaved [line 59]

int isFileSaved( )

Did we save a file?



Tags:

return:  1 if the file was saved sucessfully,
  1. no save operation, -1 file save error.


[ Top ]

method isGDEditable [line 546]

int isGDEditable( )

Check if the specified image can be edit by GD

mainly to check that GD can read and save GIFs




Tags:

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


[ Top ]

method isGDGIFAble [line 572]

int isGDGIFAble( )

Check if GIF can be edit by GD.



Tags:

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


[ Top ]

method makeRelative [line 414]

string makeRelative( string $pathA, string $file)

Specifiy the original relative path, a new filename and return the new filename with relative path.

i.e. $pathA (-filename) + $file




Tags:

return:  relative path with the new filename


Parameters:

string   $pathA   the relative file
string   $file   the new filename

[ Top ]

method processAction [line 124]

array processAction( $action, string $relative, string $fullpath, string $action,)

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.




Tags:

return:  with image information
  1. array('src'=>'url of the image''dimensions'=>'width="xx" height="yy"',
  2.  'file'=>'image file, relative''fullpath'=>'full path to the image');


Parameters:

string   $action,   should be 'crop', 'scale', 'rotate','flip', or 'save'
string   $relative   the relative image filename
string   $fullpath   the fullpath to the image file
   $action  

[ Top ]

method processImage [line 70]

array processImage( $uploadedRelative)

Process the image, if not action, just display the image.



Tags:

return:  with image information, empty array if not an image.
  1. array('src'=>'url of the image''dimensions'=>'width="xx" height="yy"',
  2.  'file'=>'image file, relative''fullpath'=>'full path to the image');


Parameters:

   $uploadedRelative  

[ Top ]

method uniqueStr [line 441]

string uniqueStr( )

Generate a unique string based on md5(microtime()).

Well not so uniqe, as it is limited to 6 characters




Tags:

return:  unique string.


[ Top ]


Documentation generated on Thu, 12 Jun 2008 13:46:27 -0500 by phpDocumentor 1.4.1