ImageUtility Class Reference


Public Member Functions

 readImage ($filename)
 writeImage ($img, $type, $filename)
 makeThumbnail ($image, $width, $height)
 makeThumbnailProportional ($image, $max_x, $max_y)
 isImageInvalid ($filename, $maxwidth, $maxheight, $minwidth=1, $minheight=1)
 simpleUploadError ($fieldname)
 getNudity ($img, $colorA=0x793B24, $colorB=0xFEC5BF)

Data Fields

const IMGERR_TOOBIG = 1
const IMGERR_TOOSMALL = 2
const IMGERR_UNKNOWNFORMAT = 4
const UPL_TOOBIG = 1
const UPL_INTERNAL = 2
const UPL_EXTENSION = 3

Detailed Description

Definition at line 21 of file imageutility.php.


Member Function Documentation

getNudity ( img,
colorA = 0x793B24,
colorB = 0xFEC5BF 
)

try to classify how likely the picture contains nudity. warning: O(scary) (read: can take several seconds depending for big pictures)

Parameters:
resource $img image-resource of the picture to classify
Returns:
float 0=no nudity 100=full frontal nudity ^^

Definition at line 210 of file imageutility.php.

isImageInvalid ( filename,
maxwidth,
maxheight,
minwidth = 1,
minheight = 1 
)

does the image conform to given parameters?

Parameters:
string $filename ...
int $maxwidth
int $maxheight
int minwidth
int minheight
mixed IMGERR_ codes

Definition at line 144 of file imageutility.php.

References IMGERR_TOOBIG, IMGERR_TOOSMALL, and IMGERR_UNKNOWNFORMAT.

makeThumbnail ( image,
width,
height 
)

simply create a thumbnail, dont make it proportional

Parameters:
image $image
int $width
int $height

Definition at line 86 of file imageutility.php.

makeThumbnailProportional ( image,
max_x,
max_y 
)

enshure picture fits proportionally into the destionation size. this could possibly result in the picture being cropped

Parameters:
image $image
int $max_x target width
int $max_y target height

Definition at line 99 of file imageutility.php.

readImage ( filename  ) 

read a gif,jpg,png from disk and return image

Parameters:
string $filename
Returns:
image

Definition at line 36 of file imageutility.php.

simpleUploadError ( fieldname  ) 

reduce several upload-errors to 3 general ones

Parameters:
string $fieldname name="" of the upload-input-element
Returns:
mixed true=success, false=no file given, UPLOAD_ERR_

Definition at line 172 of file imageutility.php.

References UPL_EXTENSION, UPL_INTERNAL, and UPL_TOOBIG.

writeImage ( img,
type,
filename 
)

write the given image to disk

Parameters:
image $img
int $type imagetype, IMAGETYPE_GIF usw.
string $filename

Definition at line 64 of file imageutility.php.


Field Documentation

const IMGERR_TOOBIG = 1

Definition at line 23 of file imageutility.php.

Referenced by isImageInvalid().

const IMGERR_TOOSMALL = 2

Definition at line 24 of file imageutility.php.

Referenced by isImageInvalid().

Definition at line 25 of file imageutility.php.

Referenced by isImageInvalid().

const UPL_EXTENSION = 3

Definition at line 29 of file imageutility.php.

Referenced by simpleUploadError().

const UPL_INTERNAL = 2

Definition at line 28 of file imageutility.php.

Referenced by simpleUploadError().

const UPL_TOOBIG = 1

Definition at line 27 of file imageutility.php.

Referenced by simpleUploadError().


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

Generated on Mon Apr 27 16:29:08 2009 for kata by  doxygen 1.5.8