wCMF
3.6
|
Public Member Functions | |
getErrorMsg () | |
isImage ($imgname) | |
isValidImageDimension ($imgname, $width, $height, $exact=true) | |
isValidImageWidth ($imgname, $width, $exact=true) | |
isValidImageHeight ($imgname, $height, $exact=true) | |
fitIntoSquare ($srcName, $maxDimension) | |
createThumbnail ($srcName, $destName, $width, $height) | |
cropImage ($srcName, $destName, $width, $height, $x=null, $y=null) | |
createBlackWhiteImage ($srcName, $destName) | |
processImageFunction ($srcName, $destName, $function, $params) | |
renderTextTTF ($text, $fontfile, $fontsize, $color, $bgcolor, $filename, $width=null, $height=null, $x=null, $y=null, $angle=0) | |
getTextDimension ($fontsize, $angle, $fontfile, $text) | |
calculateTextParams ($width, $height, $x, $y, $textwidth, $textheight) | |
calculateSizeParams ($width, $height, $imageWidth, $imageHeight) | |
Public Attributes | |
$_errorMsg = '' | |
GraphicsUtil provides support for graphic manipulation.
wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH
Licensed under the terms of any of the following licenses at your choice:
See the license.txt file distributed with this work for additional information.
Definition at line 30 of file class.GraphicsUtil.php.
GraphicsUtil::getErrorMsg | ( | ) |
Get last error message.
Definition at line 38 of file class.GraphicsUtil.php.
References $_errorMsg.
GraphicsUtil::isImage | ( | $imgname | ) |
Check if a given file is an image.
imgname | Name of the imagefile to check |
Definition at line 48 of file class.GraphicsUtil.php.
GraphicsUtil::isValidImageDimension | ( | $imgname, | |
$width, | |||
$height, | |||
$exact = true |
|||
) |
Check image dimensions.
imgname | Name of the imagefile to check |
width | Width of the image, -1 means don't care |
height | Height of the image, -1 means don't care |
exact | Boolean whether the image should match the dimension exactly or might be smaller [default: true] |
Definition at line 66 of file class.GraphicsUtil.php.
References isValidImageHeight(), and isValidImageWidth().
GraphicsUtil::isValidImageWidth | ( | $imgname, | |
$width, | |||
$exact = true |
|||
) |
Check image width.
imgname | Name of the imagefile to check |
width | Width of the image |
exact | Boolean whether the image width should match exactly or might be smaller [default: true] |
Definition at line 81 of file class.GraphicsUtil.php.
References Message\get().
Referenced by isValidImageDimension().
GraphicsUtil::isValidImageHeight | ( | $imgname, | |
$height, | |||
$exact = true |
|||
) |
Check image height.
imgname | Name of the imagefile to check |
height | Height of the image |
exact | Boolean whether the image height should match exactly or might be smaller [default: true] |
Definition at line 107 of file class.GraphicsUtil.php.
References Message\get().
Referenced by isValidImageDimension().
GraphicsUtil::fitIntoSquare | ( | $srcName, | |
$maxDimension | |||
) |
Calculate image dimension to fit into a square, preserving the aspect ratio
srcName | The source file name |
maxDimension | The maximum dimension the image should have (either width or height) |
Definition at line 131 of file class.GraphicsUtil.php.
GraphicsUtil::createThumbnail | ( | $srcName, | |
$destName, | |||
$width, | |||
$height | |||
) |
Create a thumbnail of an image file.
srcName | The source file name |
destName | The destination file name |
width | The width of the thumbnail (maybe null) |
height | The height of the thumbnail (maybe null) |
Definition at line 167 of file class.GraphicsUtil.php.
GraphicsUtil::cropImage | ( | $srcName, | |
$destName, | |||
$width, | |||
$height, | |||
$x = null , |
|||
$y = null |
|||
) |
Crop an image to the given size starting from the middle of a given start point.
srcName | The source file name |
destName | The destination file name |
width | The width of the cropped image (maybe null) |
height | The height of the cropped image (maybe null) |
x | The start point x coordinate (maybe null, default null) |
y | The start point y coordinate (maybe null, default null) |
Definition at line 191 of file class.GraphicsUtil.php.
GraphicsUtil::createBlackWhiteImage | ( | $srcName, | |
$destName | |||
) |
Create a black and white copy of an image.
srcName | The source file name |
destName | The destination file name |
Definition at line 213 of file class.GraphicsUtil.php.
GraphicsUtil::processImageFunction | ( | $srcName, | |
$destName, | |||
$function, | |||
$params | |||
) |
Process the given function on the given source image (supports animated gifs) and save the result in the given destination image.
srcName | The source file name |
destName | The destination file name |
function | The name of the function |
params | The paremeters to be passed to the function |
Definition at line 232 of file class.GraphicsUtil.php.
GraphicsUtil::renderTextTTF | ( | $text, | |
$fontfile, | |||
$fontsize, | |||
$color, | |||
$bgcolor, | |||
$filename, | |||
$width = null , |
|||
$height = null , |
|||
$x = null , |
|||
$y = null , |
|||
$angle = 0 |
|||
) |
Render a text to an image. Using the default parameters the text will be rendered into a box that fits the text. If the width parameter is not null and the text exceeds the width, the text will be wrapped and the height parameter will be used as lineheight. Wrapping code is from http://de.php.net/manual/de/function.imagettfbbox.php#60673
text | The text to render |
fontfile | The font file to use |
fontsize | The font size to use (in pixels) |
color | The color to use for the text (as HEX value) |
bgcolor | The color to use for the background (as HEX value) |
filename | The name of the file to write to |
width | The width of the image (or null if it should fit the text) [default: null] |
height | The height of the image (or null if it should fit the text) [default: null] |
x | The x offset of the text (or null if it should be centered) [default: null] |
y | The y offset of the text (or null if the baseline should be the image border) [default: null] |
angle | The angle of the text (optional) [default: 0] |
Definition at line 275 of file class.GraphicsUtil.php.
GraphicsUtil::getTextDimension | ( | $fontsize, | |
$angle, | |||
$fontfile, | |||
$text | |||
) |
Calculate the dimension of the given text
fontsize | The font size (in pixels) |
angle | The angle of the characters (optional) [default: 0] |
fontfile | The font file |
text | The text |
Definition at line 376 of file class.GraphicsUtil.php.
GraphicsUtil::calculateTextParams | ( | $width, | |
$height, | |||
$x, | |||
$y, | |||
$textwidth, | |||
$textheight | |||
) |
Calculate the offset of the text and the size of the image based on the given parameters
width | The width of the image (or null if it should be the textwidth) |
height | The height of the image (or null if it should be the textheight) |
x | The x offset of the text (or null if it should be centered) |
y | The y offset of the text (or null if the baseline should be the image border) |
textwidth | The width of the text |
textheight | The height of the text |
Definition at line 392 of file class.GraphicsUtil.php.
GraphicsUtil::calculateSizeParams | ( | $width, | |
$height, | |||
$imageWidth, | |||
$imageHeight | |||
) |
Calculate the size based on the image aspect, if only width or height are given.
width | The requested width (maybe null) |
height | The requested height (maybe null) |
imageWidth | The image's width |
imageHeight | The image's height |
Definition at line 414 of file class.GraphicsUtil.php.
GraphicsUtil::$_errorMsg = '' |
Definition at line 32 of file class.GraphicsUtil.php.
Referenced by getErrorMsg().