YANA 4 PHP Framework
Docs For Class Image
Image wrapper class
This class is an OO wrapper for PHP's image handling functions. Note that this class requires the GD library to be installed in order to work correctly. Not all functions are available in all version of this library. But the class will automatically try a fall-back to an alternative function where possible.
Also note, that this class will NOT output any error messages unless a fatal error is encountered and instead will report error to the logs. This is a intended behaviour, as any output (e.g. an error message) from the script would result in a broken image file, when the image is directly put to the user's browser.
So when you are working with this class: in case you encounter an error and want to know the cause of it, please activate the program's logging feature via the administrator's menu, reproduce the error and see the logs for the entry that describes the problem.
The following image types are currently supported:
Located in /includes/class_image.php
Object | --Image
color
color
color
color
color
color
color
color
color
color
color
color
color
color
color
color
color
Name | Type | Description |
---|---|---|
$filename | string | name of the source file |
$imageType | string | type of the image |
The argument $filename determines wich file to take the input from. If $filename is not provided, an empty truecolor image with white background and a dimension of 300x200px is created.
The argument $imageType can be on of the following.
If no image type is set, the function will try to determine the correct type of the file automatically, 1st by checking the file extension and in case this did not work 2nd by checking the file header. If all this fails it writes an entry to the logs and creates an error image instead.
NOTE: it DOES NOT produces an error message, as this would result in a broken image, if the image was printed!
To check wether or not an image is broken, use
- // handle broken image
- }
Name | Type | Description |
---|---|---|
$filter | int | a constant (see list) |
$arg1 | int | depends on filter |
$arg2 | int | depends on filter |
$arg3 | int | depends on filter |
This is an OO-style alias of PHP's imagefilter() function. See the PHP manual for a full description.
$filter can be (among others) one of the following:
Note: this is only available with PHP 5. If you are using PHP 4, check with the alternative functions named above.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$ammount | float | effect strength |
This makes the image look smoother. The argument $ammount is any float 0.0 through 1.0, which translates to 0% through 100%.
Name | Type | Description |
---|---|---|
$ammount | float | effect strength |
Adds or removes white from the image.
The argument $ammount is a float between -1.0 and 1.0. Which you might translate to -100% through 100%.
This has the same effect as calling Image::colorize($r, $g, $b), with $r, $b, $g being identical values.
Returns bool(true) on success and bool(false) on error.
The old image is deleted and replaced by a new one. Be warned: all previous changes to the image will be lost!
Creates a copy of this object. You are encouraged to reimplement this for each subclass.
Redefinition of: Object::cloneObject()
Name | Type | Description |
---|---|---|
$r | int | red value |
$g | int | green value |
$b | int | blue value |
This adds the specified color to the image, shaded in the color provided.
The arguments $r, $g, $b can be any integer of -255 through 255.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$ammount | float | effect strength |
Adds or removes grey from the image.
The argument $ammount is a float between -1.0 and 1.0. Which you might translate to -100% through 100%.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$sourceImage | Image|string|resource | the image to copy the palette from |
This copies the palette from the source image to this image.
The argument $sourceImage can be another Image object, a filename, or an image resource.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$sourceImage | Image|string|resource | filename or image resource |
$sourceX | int | horizontal position in pixel |
$sourceY | int | vertical position in pixel |
$width | int | horizontal dimension in pixel |
$height | int | vertical dimension in pixel |
$destX | int | horizontal position in pixel |
$destY | int | vertical position in pixel |
$opacity | float | alpha value in percent |
This is an OO-style alias of PHP's imagecopymerge() function. See the PHP manual for a full description.
The argument $sourceImage can be another Image object, a filename, or an image resource.
If $width and / or $height is NULL or not provided, then they are set to cover the full size of the image.
If $sourceX and / or $sourceY is NULL or not provided, then they are set to 0 (the upper left corner).
If $destX and / or $destY is NULL or not provided, then they are set to the same values as $sourceX and $sourceY.
The $opacity parameter is available for truecolor images only. It is a float between 0.0 (completely opaque) and 1.0 (completely transparent). You may translate this to 0% through 100% opacity. Note that opacity only applies when alpha blending has has not been disabled and the underlying function is available.
To copy the whole source image to the current image, just write:
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$x | int | horizontal position |
$y | int | vertical position |
$width | int | horizontal dimension in pixel |
$height | int | vertical dimension in pixel |
$color | int | the color of the contour line |
$fillColor | int | the color to flood fill the ellipse with |
$start | int | angle in degrees (start) |
$end | int | angle in degrees (end) |
This draws an ellipse at position ($x px, $y px).
With the dimensions $width px to $height px. Note that you can set $width = $height to create a circle. Setting $height = NULL does the same.
The $color is an integer value, that you can get via the function Image::getColor().
In addition you may also use on of the predefined colors: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, or yellow.
Example:
The same applies to $fillColor. When provided, a filled object is created. You can create object that are not filled, by setting this to NULL.
Setting $start and $end will create an arcus, that starts at $start degrees and goes to $end degrees. Both values can be NULLed. Note that $start and $end can also be negative.
Name | Type | Description |
---|---|---|
$text | string | the text to draw |
$x | int | horizontal position |
$y | int | vertical position |
$color | int | the text color |
$fontfile | string | path and name of a true-type (*.ttf) font |
$fontsize | int | size |
$angle | int | rotation 0 through 360 degrees |
This is the same as Image::drawString() except, that it allows some true-type font of your choosing to be used, accepts a custom font size and allows to freely choose an angle of rotation.
The rotation is performed anticlockwise. To create a text that flows straight up, set $angle to 90.
The default font is 'tahoma'. The path to the font file needs to start with a '/' sign.
Note that $fontfile my also be just the name of font, like 'tahoma', 'arial', or 'helvetica'. If the name instead of the file is provided, this function will try to use a true-type font of the same name, which is installed on the current system. Of course this requires that the font actually IS installed on the system.
Name | Type | Description |
---|---|---|
$x1 | int | horizontal position (start) |
$y1 | int | vertical position (start) |
$x2 | int | horizontal position (end) |
$y2 | int | vertical position (end) |
$color | int | the line color |
This draws a straight line at position ($x px, $y px).
The line has the color set by the argument $color. This defaults to black.
Name | Type | Description |
---|---|---|
$x | int | horizontal position (left value) |
$y | int | vertical position (top value) |
$color | int | the point color |
This paints the pixel at position ($x px, $y px) with a $color. This color defaults to black.
Name | Type | Description |
---|---|---|
$points | array | a list of vertices |
$x | int | horicontal position |
$y | int | vertical position |
$color | int | color of contour line |
$fillColor | int | inner color |
This draws a polygon at position ($x px, $y px).
$points is a two dimensional array of the vertices. Example:
- $points = array(
- 0 => array( 10, 0 ),
- 1 => array( 20, 10 ),
- 2 => array( 0, 10 )
- );
- exit;
The $color is an integer value, that you can get via the function Image::getColor().
In addition you may also use on of the predefined colors: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, or yellow.
Example:
The same applies to $fillColor. When provided, a filled object is created. You can create object that are not filled, by setting this to NULL.
Name | Type | Description |
---|---|---|
$x | int | horicontal position in pixel |
$y | int | vertical position in pixel |
$width | int | horizontal dimension in pixel |
$height | int | vertical dimension in pixel |
$color | int | color of contour line |
$fillColor | int | inner color |
This draws a rectangle at position ($x px, $y px).
With the dimensions $width px to $height px. Note that you can set $width = $height to create a square. Setting $height = NULL does the same.
The $color is an integer value, that you can get via the function Image::getColor().
In addition you may also use on of the predefined colors: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, or yellow.
Example:
The same applies to $fillColor. When provided, a filled object is created. You can create object that are not filled, by setting this to NULL.
Name | Type | Description |
---|---|---|
$text | string | the text to draw |
$x | int | horizontal position |
$y | int | vertical position |
$color | int | the text color |
$font | int | font size (1 through 5) |
$asVerticalString | bool | switch between horizontal and vertical print |
This draws a text string at position ($x px, $y px).
The string has the color set by the argument $color. This defaults to black.
The $color is an integer value, that you can get via the function Image::getColor().
In addition you may also use on of the predefined colors: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, or yellow.
Example:
The argument $font determines the font type and size. The values 1-5 are used for a predefined system font. Where 1 is the smallest font-size and 5 is the largest. The font itself belongs to the sans-serif family. Note that you can load custom fonts using the PHP function imageloadfont(). The argument $font defaults to 2, which is a 10px font.
The argument $asVerticalString is used to switch from printing text horizontal to vertical. Note that vertical strings are rotated 90° left (anticlockwise). This means they will start at ($x px, $y px) upwards, so you should make sure, there is enough space for the string on your image above the starting point.
All arguments except $text may be skipped by assigning the NULL value.
Name | Type | Description |
---|---|---|
$isEnabled | bool | on / off |
$saveAlpha | bool | on / off |
Enables alpha blending if set to bool(true) and disables it when set to bool(false).
Works only with truecolor images.
If $saveAlpha is true and the output is a PNG image, the alpha channel information will get saved with the file, otherwise not. Note that this setting only affects PNG images.
You should be aware, that IE 6.0 and other older browsers do not support alpha channels in PNG images by default.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$isEnabled | bool | on / off |
Enables antialiasing if set to bool(true) and disables it when set to bool(false).
Works only with truecolor images.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$isInterlaced | bool | on / off |
If $isInterlaced is true, interlacing is set to on, otherwise set to off.
If the image is a JPEG, this setting will set the output to be a progressive image.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$anotherObject | object | any object or var you want to compare |
Returns bool(true) if this object and $anotherObject are the booth object which have an image resource that is the same, or $anotherObject is an image resource and identical to the one of this object.
Retunrs bool(false) otherwise.
Redefinition of: Object::equals()
Name | Type | Description |
---|---|---|
$fillColor | int | the filled area will get this color |
$x | int | horicontal position |
$y | int | vertical position |
$borderColor | int | flood fill will stop at this color |
This does a flood fill at position ($x px, $y px).
The $fillColor is an integer value, that you can get via the function Image::getColor().
In addition you may also use on of the predefined colors: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, or yellow.
Example:
If $borderColor is defined, flood fill will stop at the this color, otherwise it will stop at any color that is different from pixel ($x px, $y px).
Returns bool(true) on success and bool(false) on error.
}
Returns bool(true) on success and bool(false) on error.
}
Returns the current background color as an integer or bool(false) on error.
Name | Type | Description |
---|---|---|
$r | int | red value |
$g | int | green value |
$b | int | blue value |
$opacity | float | alpha value |
This is an OO-style alias of PHP's imagecolorallocate() function. See the PHP manual for a full description.
The $opacity parameter is available as of PHP 4.3.2. It is a float between 0.0 (completely opaque) and 1.0 (completely transparent). You may translate this to 0% through 100% opacity. Note that opacity only applies when alpha blending has has not been disabled and the underlying function is available.
If the current palette already has the specified color, the existing color will be returned. Otherwise the new color will get appended to the palette.
Returns bool(false) on error.
Name | Type | Description |
---|---|---|
$x | int | horicontal position |
$y | int | vertical position |
This is an OO-style alias of PHP's imagecolorat() function. See the PHP manual for a full description.
This function returns bool(false) on error.
Name | Type | Description |
---|---|---|
$color | int | a color resource |
This is an OO-style alias of PHP's imagecolorsforindex() function. See the PHP manual for a full description.
Example:
Name | Type | Description |
---|---|---|
$font | int | a font resource |
This is an OO-style alias of PHP's imagefontheight() function. See the PHP manual for a full description.
The argument $font determines the font type. The values 1-5 are used for a predefined system font. Where 1 is the smallest font-size and 5 is the largest. The font itself belongs to the sans-serif family. Note that you can load custom fonts using the PHP function imageloadfont().
This function is usefull to calculate how much space a string is going to take on the picture when using this font.
Name | Type | Description |
---|---|---|
$font | int | a font resource |
This is an OO-style alias of PHP's imagefontheight() function. See the PHP manual for a full description.
The argument $font determines the font type. The values 1-5 are used for a predefined system font. Where 1 is the smallest font-size and 5 is the largest. The font itself belongs to the sans-serif family. Note that you can load custom fonts using the PHP function imageloadfont().
This function is usefull to calculate how much space a string is going to take on the picture when using this font.
Returns the image's vertical dimension in pixel or bool(false) on error.
Returns the current line width in pixel as an integer value.
Returns bool(false) on error.
Returns bool(false) on error.
For palette images the number of colors is the number of colors used in the current image. For truecolor images the maximum number of colors is returned, which is always 16 million.
Note that if you reduce the color depth using $image->reduceColorDepth($number), This function may NOT return $number, but instead the number of colors that are actually used in the image, which may be less then $number.
This returns the image resource of the object, or bool(false) on error.
Name | Type | Description |
---|---|---|
$filename | string | relative file path |
This is an OO-style alias of PHP's getimagesize() function. See the PHP manual for a full description.
The following two lines are equal:
Just choose the style that you prefer.
Returns bool(false) on error.
Returns the image's horizontal dimension in pixel or bool(false) on error.
This returns bool(true) if alpha channel is turned on for the current image. Returns bool(false) otherwise.
Compatibility note: This function has been renamed in version 2.8.8 from "hasAlphaChannel()" to "hasAlpha()".
Returns bool(true) if the image type was not recognized. Returns bool(false) otherwise.
This returns bool(true) if interlacing is turned on for the current image. Returns bool(false) otherwise.
Returns bool(true) if the image is truecolor and bool(false) otherwise.
Truecolor images are e.g. JPEG images while GIF is not. Some functions won't work with non-truecolor images.
Name | Type | Description |
---|---|---|
$r | int | red value |
$g | int | green value |
$b | int | blue value |
This produces a monochromatic version of the image, shaded in the color provided.
The arguments $r, $g, $b can be any integer of 0 through 255.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$r | int | red value |
$g | int | green value |
$b | int | blue value |
The color provided multiplies with each color in the palette. For example, this is usefull to filter colors.
Extract the green channel of an image:
Removing some red from an image will remove a red stitch and shift the colors towards a cold turquoise:
Shifting cold blue colors towards warm orange colors:
The arguments $r, $g, $b can be any integer of 0 through 255.
Returns bool(true) on success and bool(false) on error.
This function negates all colors.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$filename | string | name of the output file |
$imageType | string | can be on of "png", "jpg", "gif", "bmp" |
Returns the name of the output file on success and bool(false) on error.
You may leave off the file extension. If so the function will determine the correct extension by itself and append it automatically to the argument $filename.
If the file already exists, it will get replaced.
The optional argument $imageType can be used to set a prefered image type.
If no prefered image type is set, or the prefered image type is not available, then this function will automatically try to create a PNG image. If PNG is not available it will automatically try fall back to another type. PNG will fall back to JPEG, JPEG to GIF, GIF to BMP. Only if nothing of the above worked, it will give up and returns bool(false). Otherwise bool(true) is returned.
Name | Type | Description |
---|---|---|
$imageType | string | can be on of "png", "jpg", "gif", "bmp" |
Returns bool(true) on success and bool(false) on error.
The optional argument $imageType can be used to set a prefered image type.
If no prefered image type is set, or the prefered image type is not available, then this function will automatically try to create a PNG image. If PNG is not available it will automatically fall back. PNG will fall back to JPEG, JPEG to GIF, GIF to BMP. If nothing of the above worked it gives up and returns bool(false).
Name | Type | Description |
---|---|---|
$ammount | int | effect strength |
$dither | bool | on / off |
Returns bool(true) on success and bool(false) on error.
Reduces the color depth of the current image to $ammount colors. The argument $ammount is an integer 2 through 256.
The argument $dither triggers whether or not dithering is used while reducing the colors for the current image.
Name | Type | Description |
---|---|---|
$replacedColor | int | index of replaced color |
$newColor | int | index of the new color |
This replaces the replaced color by a new color.
To be more technical, this is done by setting the replaced color as transparent, setting the new color as background and merging the results to a new image. Then reseting transparency and background color to the previously set values.
This may take some time - if you prefer a more performant solution, see Image::replaceIndexColor() instead.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$replacedColor | int | index of replaced color |
$newColor | array|int | the color the should be assigned |
This replaces the palette color with the index $replacedColor by the color with the index $newColor. Note that $newColor can also be an associative array with the keys 'red', 'green' and 'blue'.
Returns bool(true) on success and bool(false) on error.
Note that this only works on palette (non-truecolor) images and thus returns false if the image is truecolor. Also note, that all images are converted to truecolor by default.
Examples:
Name | Type | Description |
---|---|---|
$width | int | horizontal dimension in pixel |
$height | int | vertical dimension in pixel |
This resizes the image to $width x $height.
You may set either $width or $height to NULL to get a proportional resize.
Returns bool(false) on error.
IMPORTANT NOTE: this function resets some settings. E.g. transparency, color depth a.s.o. will be lost.
Name | Type | Description |
---|---|---|
$width | int | horizontal dimension in pixel |
$height | int | vertical dimension in pixel |
$paddingLeft | int | horizontal offset |
$paddingTop | int | vertical offset |
$canvasColor | array | array of red, green, yellow values (0 through 255) to identify the canvas color, defaults to background color |
This resizes the canvas to $width x $height.
You may set either $width or $height to NULL to get a proportional resize. If $width or $height is smaller than the current value, the parts of the image that do not fit will get cut.
The $paddingLeft and $paddingTop parameters set left and top padding for the canvas. Setting both to 0 will position the left-top corner of the original image at the point (0, 0) on the new image. If the original image was bigger than the new, the parts at the right and the bottom the are outside the canvas will get cut. Note that you may use negative numbers here. Still you may not completely move the image outside the canvas.
If $left and/or $top are not provided, the image will get copied to the center of the canvas.
Examples:
- // original image is 300x200px
- // this will return true, but does nothing at all
- // resize to 150x100px
- // same effect
- // cut 20px off the top
- // the image is centered horizontally
- // cut 50px off the left
- // the image is centered vertically
- // cut 50px off the right
- // the image is centered vertically
- // combination of all
- // these will return false
- // padding value out of range
Returns bool(false) on error.
Name | Type | Description |
---|---|---|
$width | int | horizontal dimension in pixel |
$height | int | vertical dimension in pixel |
alias of Image::resize()
Name | Type | Description |
---|---|---|
$angle | float | angle of rotation in degree |
This rotates the image anticlockwise by $angle degrees.
This function became available with PHP 4.3.
Name | Type | Description |
---|---|---|
$backgroundColor | int | index of new background color |
$replaceOldColor | bool |
If you don't specify a background color, than the color is reset.
By default the background color will be set to the transparent color of the image if it has any. Otherwise it defaults to white.
If the argument $replaceOldColor is set to true, it will replace the all pixel of the previous background color with the new one. It it is set to false, the new background color will get appended and all pixel of the old color will remain as is.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$brush | string|Image|Brush|resource | a brush resource |
Sets the brush used by imageline(), imagepolygon() et cetera to the image $brush.
The argument $brush can be a filename of the image that you want to use as the brush to use, or another image object. In addition $brush may also be an image resource.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$gamma | float | effect strength |
Gamma can be any positive float 0.1 trough 10.0 The base is always 1.0 (100%). So e.g. calling setGamma(0.1) sets the gamma of the image to 10% and calling setGamma(2.0) sets the gamma to 200%. To reset the gamma value call setGamma(1.0).
This function only works on truecolor images.
Returns bool(true) on success and bool(false) on error.
This is an OO-style alias of PHP's imagesetstyle() function. See the PHP manual for details.
Example:
- // dotted line
- // 3px dashed line
To reset the line style, call this function with no arguments.
Name | Type | Description |
---|---|---|
$width | int | size in pixel |
Sets the line width of the current brush to $width. The setting will apply to whatever you draw, until you call this function again.
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$transparency | int|array | new transparent color |
Returns bool(true) on success and bool(false) on error.
The $transparency color is an integer value, that you can get via the function Image::getColor().
In addition you may also use on of the predefined colors: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, or yellow.
Example:
If $transparency is not set, the current background color will be used instead.
Name | Type | Description |
---|---|---|
$ammount | float | effect strength |
This sharpens the image. The argument $ammount is any float 0.0 through 1.0, which translates to 0% through 100%.
This converts the palette colors to gray values.
This function is intended to be called when the object is used in a string context.
Redefinition of: Object::toString()
Name | Type | Description |
---|---|---|
$fromId | string | identifier of the form-field from which the file has been sent |
$toFilename | string | the path and filename to output the file to |
$imageType | string | prefered type of the output file |
$maxSize | int | maximum size of uploaded files in byte |
$width | int | horizontal dimension of the output image in pixel |
$height | int | vertical dimension of the output image in pixel |
$keepAspectRatio | bool | vertical dimension of the output image in pixel |
$backgroundColor | array | array of red, green, yellow values (0 through 255) to identify the background color, defaults to white |
The purpose of this method is to handle an uploaded image.
The image is taken from the $_FILES array at the index provided by the argument $fromId ($_FILES[$fromId]). The argument is case-insensitive.
The method converts the image to the type given by the argument $imageType, which currently can be "gif", "png" or "jpg".
The image is resized to the dimensions given by the arguments $width x $height. If you set one of these to NULL, the other one will be determined automatically. If you leave booth to NULL, the image will not be resized at all.
The argument $keepAspectRatio triggers how the image is resized. If it is false, the image will be stretched or compressed to the dimensions of the output image. If it is true, will be resized proportionally and the canvas will expanded to the size of the output instead, if necessary.
When using the setting true (which is the default), you may provide a background color for the canvas using the argument $backgroundColor. To do so, provide an array with the red, green and yellow values. Example: array(255, 255, 255) is "white".
The converted and resized image is then copied to the path given by the argument $toFilename.
The method returns the name of the output file on success and an integer constant on error.
Possible error codes returned by this method are:
You may leave off the file extension. If so the function will determine the correct extension by itself and append it automatically to the argument $filename.
If the file already exists, it will get replaced.
The optional argument $imageType can be used to set a prefered image type.
If no prefered image type is set, or the prefered image type is not available, then this function will automatically try to create a PNG image. If PNG is not available it will automatically try fall back to another type. PNG will fall back to JPEG, JPEG to GIF, GIF to BMP. Only if nothing of the above worked, it will give up and returns bool(false). Otherwise bool(true) is returned.
Example of usage:
HTML-Code:
- <form method="POST" action="%PHP_SELF%" enctype="multipart/form-data">
- ...
- Upload image: <input type="file" name="my_image" />
- ...
- </form>
PHP-Code:
- // get data from form field 'my_image'
- $id = 'my_image';
- // output to directory 'foo/bar/' using filename 'image'
- // (extension will be determined automatically)
- $file = 'foo/bar/image';
- // output as png image
- $type = 'png';
- // limit upload to 150 kbyte
- $size = 150000;
- // resize to 150px x 200px
- $width = 150;
- $height = 200;
- // leave aspect-ratio untouched
- $ratio = true;
- // set background color to gray
- $color = array(80, 80, 80);
-
- // call method
-
- // check for errors
- print "The image was successfully uploaded to: ".$result;
- } else {
- switch ($result)
- {
- case UPLOAD_ERR_SIZE: case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE:
- die( "File too big!" );
- break;
- case UPLOAD_ERR_NO_FILE:
- die( "No file has been uploaded!" );
- break;
- case UPLOAD_ERR_INVALID_TARGET:
- die( "Unable to write to file: ".$file );
- break;
- case UPLOAD_ERR_FILE_TYPE:
- die( "The file is not a recognized image!" );
- break;
- default:
- die( "Some unexpected error occured!" );
- break;
- }
- }
Inherited From Object
Documentation generated on Sun, 11 Mar 2007 15:02:31 +0100 by phpDocumentor 1.3.1