Class net_siriux_photos_imagefilter

Description

Image Filter Class, used to post process all images, check the documentation of the individual methods.

Located in /net/siriux/photos/filter.php (line 24)


	
			
Variable Summary
 string $_filename
 string $_quality
Method Summary
 net_siriux_photos_imagefilter net_siriux_photos_imagefilter ()
 The execute_user_callback (string $command, array $args)
 true exifrotate ()
 true gamma ($gamma $gamma)
 true, process_chain (string $chain)
 true, process_command (string $cmd)
 true rescale (int $x, int $y)
 true rotate ($rotate $rotate)
 true, set_file (string $filename)
 void _get_tempfile ()
 void _process_tempfile (mixed $tmpname)
Variables
string $_filename (line 33)

The file currently being processed.

  • access: private
string $_quality (line 43)

The quality to use for JPEG manipulation, this is not yet settable from the outside. Stored as a valid imagemagick option, defaults to '-quality 90' right now.

  • access: private
Methods
Constructor net_siriux_photos_imagefilter (line 48)

The constructor does a bit of variable initialization

net_siriux_photos_imagefilter net_siriux_photos_imagefilter ()
execute_user_callback (line 221)

Executes a custom image manipulation callback. The command name is the function that is searched. The function must use the following signature:

bool callback (string $infile, $string outfile, array $parameters);

infile is the file to be manipulated, outfile the name where the result has to be stored in (a temporary file usually) and the parameters passed to the command originally. It should return true on a successful transformation, false otherwise.

  • return: return code of the callback.
The execute_user_callback (string $command, array $args)
  • string $command: The name of the callback to execute
  • array $args: The arguments passed to the callback
exifrotate (line 280)

Automatic rotation for the image using EXIF tags.

NOTE: This REQUIRES php_read_exif to be present. It will fail if it is missing.

Filter Syntax: exifrotate()

  • return: on success.
true exifrotate ()
gamma (line 249)

Gamma-Adjustment of the image.

Filter Syntax: gamma($gamma)

Where $gamma is a positive floating point number, e.g. 1.2

  • return: on success.
true gamma ($gamma $gamma)
  • $gamma $gamma: Gamma adjustment value.
process_chain (line 89)

This function will process a string-based filter chain. This is a semicolon-separated list of commands, which will be evaluated using process_command each.

Processing stops as soon as one filter command fails.

  • return: if all filters have been successfully applied, false otherwise.
true, process_chain (string $chain)
  • string $chain: chain The filter chain to be processed (filter1();filter2();...)
process_command (line 120)

This is the main function evaluator of the filter class.

It will take a function style command like rotate(90), arguments are separated by commas, there is no quoting at the moment. All arguments are parsed as strings, function names need to be [a-z_]

Execution will relay to the corresponding filter function.

All filters will use defaults for missing arguments (which can result in a NULL operation) and will ignore excessive arguments.

  • return: if the filter executed successfully, false otherwise.
true, process_command (string $cmd)
  • string $cmd: cmd The command to be executed.
rescale (line 457)

Image Resize: This will resize the orignal image.

Filter Syntax: resize ($x, $y)

The width of the image in pixels, it will be scaled in proportion. One of the two parameters can be 0, meaning that the width/height of the image is adjusted to the other, given value.

The resize will be done only if it would not increase the image as this won't gain you any benifit.

  • return: on success.
true rescale (int $x, int $y)
  • int $x: Width
  • int $y: Height
rotate (line 381)

Manual image rotation

Filter Syntax: rotate($rotate)

Where $gamma is a positive floating point number greater then 0 and less then 360; if omitted, a NULL operation is done.

  • return: on success.
true rotate ($rotate $rotate)
  • $rotate $rotate: Degrees of rotation clockwise, negative amounts possible
set_file (line 68)

Sets the filename of the image currently being edited.

This must be the full path to the file, the fill will be replaced with the modified image.

The process will check for write permission at this point, A return value of false will indicate some problem, see the MidCOM Debug Log for details.

TODO: Use ImageMagick Identify to check for a valid image.

  • return: if the file is valid, false otherwise.
true, set_file (string $filename)
  • string $filename: filename The file to be edited.
_get_tempfile (line 180)

Returns the name of a temporary file to be used to write the transformed image to. Has to be managed by the callee.

void _get_tempfile ()
_process_tempfile (line 189)

This will replace the original file with the processed copy of $tmpfile, deleting the temporary file afterwards.

void _process_tempfile (mixed $tmpname)

Documentation generated on Mon, 21 Nov 2005 18:15:49 +0100 by phpDocumentor 1.3.0RC3