eZImageShell Class Reference
[Image conversion and scaling]

Image conversions delegate using shell commands. More...

List of all members.


Public Methods

 eZImageShell ($execPath,$exec,$pre_params,$post_params,$rules,$from_type=EZ_IMAGE_KEEP_SUFFIX,$to_type=EZ_IMAGE_REPLACE_SUFFIX)
createRule ($expr,$rule_type,$type=EZ_IMAGE_PRE_PARAM)
convertFileName ($from,$type,$as_pure_file=false,$add_dir=true)
 convert (&$from,&$to,&$to_dir,&$to_file,&$filters)
 scale (&$from,&$to,&$to_dir,&$to_file,&$filters,$scale)
 addParameter (&$pre,&$post,$type,$str)
 parseScaleRule ($rule,$scale)
 run (&$execstr,$dest_str)

Public Attributes

 ExecPath
 The path to the executable.

 Exec
 The file to execute for image conversion.

 PreParams
 Array of parameters which are added before the files.

 PostParams
 Array of parameters which are added after the files.

 FromType
 The filename operation to run on the source file.

 ToType
 The filename operation to run on the destination file.


Private Methods

 conversionString (&$from,&$to,$pre,$post,&$to_dir,&$to_file,&$dest_str)
 handle (&$from,&$to,&$to_dir,&$to_file,&$pre,&$post,&$filters)
 parseRule (&$rule,$param)

Detailed Description

Image conversions delegate using shell commands.

This class should handle most the image shell programs out there. It builds a shell commandline using pre and post parameters as well as scale and operation rules.

Filename handling is specified in the constructor and can handle on of four cases.

  • EZ_IMAGE_KEEP_SUFFIX - keeps the original suffix
  • EZ_IMAGE_REPLACE_SUFFIX - replaces the suffix with one fitting for the source/dest
  • EZ_IMAGE_APPEND_SUFFIX - appends a fitting suffix to the filename, keeping the original.
  • EZ_IMAGE_PREPEND_SUFFIX_TAG - prepends the filetype to the filename, for instance png:
  • EZ_IMAGE_NO_SUFFIX - removes the suffix
$img->registerType( 'convert', new eZImageShell( '', 'convert', array(), array(),
                                                 array( eZImageShell::createRule( "-geometry %wx%h>",
                                                                                  "modify/scale" ),
                                                        eZImageShell::createRule( "-colorspace GRAY",
                                                                                  "colorspace/gray" ) ) ) );

Definition at line ezimageshell.php.


Constructor & Destructor Documentation

eZImageShell::eZImageShell   execPath,
  exec,
  pre_params,
  post_params,
  rules,
  from_type = EZ_IMAGE_KEEP_SUFFIX,
  to_type = EZ_IMAGE_REPLACE_SUFFIX
 

Initializes a shell program, $exec contains the executable command, $pre_params and $post_params is an array of parameters which are prepended and appended, $rules is an array of rules create rules with createRule(), $from_type specifies what happens with the source filename and $to_type specifies what happens with the destination filename.

Definition at line ezimageshell.php.

References ToType.


Member Function Documentation

eZImageShell::addParameter &$    pre,
&$    post,
  type,
  str
 

Adds the parameter $str to either the pre list $pre or the post list $post according to the type $type.

Definition at line ezimageshell.php.

Referenced by scale().

eZImageShell::conversionString &$    from,
&$    to,
  pre,
  post,
&$    to_dir,
&$    to_file,
&$    dest_str
[private]
 

Creates the commandline string which is required for running the shell program.

Definition at line ezimageshell.php.

References ExecPath.

Referenced by handle().

eZImageShell::convert &$    from,
&$    to,
&$    to_dir,
&$    to_file,
&$    filters
 

Runs the conversion on the file and returns the result.

Definition at line ezimageshell.php.

References handle().

& eZImageShell::convertFileName   from,
  type,
  as_pure_file = false,
  add_dir = true
 

Converts the filename $from according to $type. See class documentation or different types you can use.

Definition at line ezimageshell.php.

Referenced by conversionString().

& eZImageShell::createRule   expr,
  rule_type,
  type = EZ_IMAGE_PRE_PARAM
 

Creates a new operation rule and returns it. $expr is the text parameter which is added to the commandline, $rule_type is a string representing the name of the current rule which is used for determing if a converter can handle the wanted image operation, $type is either EZ_IMAGE_PRE_PARAM or EZ_IMAGE_POST_PARAM.

Definition at line ezimageshell.php.

eZImageShell::handle &$    from,
&$    to,
&$    to_dir,
&$    to_file,
&$    pre,
&$    post,
&$    filters
[private]
 

Converts and/or scales the image.

Definition at line ezimageshell.php.

References run().

Referenced by scale().

eZImageShell::parseRule &$    rule,
  param
[private]
 

Returns the "expression" part of the rule $rule.

Definition at line ezimageshell.php.

Referenced by handle().

eZImageShell::parseScaleRule   rule,
  scale
 

Parses the scale rule $rule with the width and height from $scale and returns the text.

Definition at line ezimageshell.php.

References scale().

Referenced by scale().

eZImageShell::run &$    execstr,
  dest_str
 

Runs the command $execstr.

Definition at line ezimageshell.php.

References eZDebug::writeWarning().

Referenced by handle().

eZImageShell::scale &$    from,
&$    to,
&$    to_dir,
&$    to_file,
&$    filters,
  scale
 

Runs the conversion and scale on the file and returns the result.

Definition at line ezimageshell.php.

References scale().

Referenced by scale().


The documentation for this class was generated from the following file:  

Exponential