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

Class: Base_Imagemagick

Source Location: /base_classes/imagemagick.class.php

Class Overview


Project: Welcompose File: imagemagick.class.php


Author(s):

  • Andreas Ahlenstorf

Copyright:

  • 2008 creatics, Olaf Gleba

Variables

Methods



Class Details

[line 25]
Project: Welcompose File: imagemagick.class.php

Copyright (c) 2008 creatics

Project owner: creatics, Olaf Gleba 50939 Köln, Germany http://www.creatics.de

This file is licensed under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE v3 http://www.opensource.org/licenses/agpl-v3.html

$Id: imagemagick.class.php 32 2006-02-28 21:09:35Z andreas $




Tags:

author:  Andreas Ahlenstorf
copyright:  2008 creatics, Olaf Gleba
license:  GNU AFFERO GENERAL PUBLIC LICENSE v3


[ Top ]


Class Variables

static $instance =  null

[line 31]

Singleton


Type:   object


[ Top ]



Class Methods


constructor __construct [line 48]

Base_Imagemagick __construct( string $convert_bin)

Constructor

Please use Base_Imagemagick::instance() to get an instance of this class.




Tags:

throws:  Base_ImagemagickException
access:  protected


Parameters:

string   $convert_bin   Path to convert binary

[ Top ]

method convert [line 97]

string convert( string $old_file, string $new_file, [bool $overwrite = true])

Convert image

Converts image old_file from one format to another and saves the result to new_file. Takes the source file name as first argument and the target file name as second argument. If the target file already exists it will be overwritten unless overwrite is set to false.

Used ImageMagick command

  1.  $ /usr/bin/convert source.tiff image.jpg




Tags:

return:  Path to target file
throws:  Base_ImagemagickException
access:  public


Parameters:

string   $old_file   Source file
string   $new_file   Target file
bool   $overwrite   Overwrite target file yes/no

[ Top ]

method fontFileCheck [line 396]

$file fontFileCheck( string $file)

Check font file

Verifies that $file does exist and is readable by the webserver.




Tags:

throws:  Base_ImagemagickException
access:  protected


Parameters:

string   $file   target file

[ Top ]

method instance [line 70]

object instance( string $convert_bin)

Singleton



Tags:

access:  public


Parameters:

string   $convert_bin   path to convert binary

[ Top ]

method rotate [line 205]

string rotate( string $old_file, string $new_file, string $degrees, [bool $overwrite = true])

Rotate image

Rotate image $old_file into a new position and save the result top $new_file. $degrees could be either a negative or a positive number.

CLI command

  1. $ /usr/bin/convert -rotate <sizesource.tiff image.jpg




Tags:

return:  returns $new_file
throws:  Base_ImagemagickException
access:  public


Parameters:

string   $old_file   image to rotate
string   $new_file   file to save result to
string   $degrees   degrees to rotate
bool   $overwrite   overwrite $new_file if $new_file already exists

[ Top ]

method scale [line 146]

string scale( string $old_file, string $new_file, string $size, [bool $overwrite = true])

Scale image

Scales $old_file to the desired $size and saves the result to $new_file.

CLI command

  1. $ /usr/bin/convert -scale <sizesource.tiff image.jpg

For further details regarding the possible values for $size see http://www.imagemagick.org/www/ImageMagick.html#details-scale




Tags:

return:  returns $new_file
throws:  Base_ImagemagickException
access:  public


Parameters:

string   $old_file   file to scale
string   $new_file   file to save result to
string   $size   desired size
bool   $overwrite   overwrite $new_file if $new_file already exists

[ Top ]

method sourceFileCheck [line 322]

string sourceFileCheck( string $file)

Check source files

Verifies that $file does exist and is an image. If one of these conditions isn't true, an exception will be thrown.




Tags:

return:  returns $file
throws:  Base_ImagemagickException
access:  protected


Parameters:

string   $file   path to source file

[ Top ]

method targetFileCheck [line 360]

$file targetFileCheck( string $file, [bool $overwrite = true])

Check target files

Verifies that $file doesn't exist (if $overwrite = false) and that the target directory is writeable by the webserver.




Tags:

throws:  Base_ImagemagickException
access:  protected


Parameters:

string   $file   target file
bool   $overwrite   overwrite $file if $file already exists

[ Top ]

method watermark [line 271]

string watermark( string $old_file, string $new_file, array $conf, [bool $overwrite = true])

Create watermarks

Creates a watermark on $old_files and saves the result to $new_file. $conf is an array of configuration settings.

Contents of $conf:

  • font: Path to the TTF file
  • pointsize: Font size in points
  • color: Font color
  • position: Start position of the text (x, y)
  • text: Text to draw

A list of allowed values for color could be found on http://imagemagick.org/www/ImageMagick.html#details-fill.

CLI command

  1. $ /usr/bin/convert -font euron.ttf -fill white -pointsize 16 \
  2. > -draw 'text 10,160 "This is a watermark"' \
  3. keira_knightley.jpg keira_watermark.jpg




Tags:

return:  returns $new_file
throws:  Base_ImagemagickException
access:  public


Parameters:

string   $old_file   file to manipulate
string   $new_file   file to safe result to
array   $conf   config array
bool   $overwrite   overwrite $new_file if $new_file already exists

[ Top ]

method watermarkConfCheck [line 425]

void watermarkConfCheck( array &$conf)

Check watermark configuration

See watermark() for allowed values




Tags:

throws:  Base_ImagemagickException
access:  protected


Parameters:

array   &$conf   array of configuration values

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:51:52 +0100 by phpDocumentor 1.4.3