Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | List of all members
eZPBImageFile Class Reference
Inheritance diagram for eZPBImageFile:

## Public Member Functions
| __construct ()
| isImage ()
| scaleCopy ( $dest, $width, $height, $convertToGray=false, $aspectScale=true)
| convertCopy ( $dest)
Public Member Functions inherited from eZPBFile
| getUploadedFile ( $name_var)
| dumpDataToFile ( $data, $fileName)
| dumpFroogleDataToFile ( $data, $fileName)
| dumpYahooDataToFile ( $data, $fileName)
| getFile ( $fileName)
| move ( $dest)
| copy ( $dest)
| name ()
| type ()
| size ()
| tmpName ()
| setType ( $type)

## Static Public Member Functions
static & | information ( $file, $use_default=false)
static & | defaultInformation ()
Static Public Member Functions inherited from eZPBFile
static & | siFileSize ( $size)
static | file_exists ( $filename)
static | is_file ( $filename)
static | filemtime ( $filename)
static | fopen ( $filename, $options)
static | filesize ( $filename)
static | unlink ( $filename)
static | chmod ( $filename, $mode)
static | dir ( $dir, $add_sitedir=true)
static | is_dir ( $dir)
static | realpath ( $filename)
static | file ( $filename)

## Additional Inherited Members
Public Attributes inherited from eZPBFile
| $FileName
| $TmpFileName
| $FileType
| $FileSize

## Detailed Description

! eZCommon The eZPBImageFile class handles fileuploads, and image specific functions like scale.

NOTE: this class requires the ImageMagic convert program. You can get it from: http://www.wizards.dupont.com/cristy/ImageMagick.html

Example:

You need a HTML file like:
<form method="post" action="script_url" enctype="multipart/form-data">
<input type="hidden" name="max_file_size" value="3000000">
Image:<br>
<input name="userfile" type="file" /><br>
<input type="submit" value="OK" />
</form>
And in the script_url you put code like:
$file = new eZPBImageFile();
// note: userfile is not a variable it's a "text" string. The value
// must be the same as the one used in the input.
if ( $file->getFile( "userfile" ) )
{
print( $file->name() . " uploaded successfully" );
// copy and scale the uploaded file
$file->scaleCopy( "tmp/" . $file->name(), 120, 200 );
}
else
{
print( "Error uploading file." );
}
eZPBFile\name
name()
Definition: ezpbfile.php:189
eZPBFile\file
static file( $filename)
Definition: ezpbfile.php:428
eZPBFile\type
type()
Definition: ezpbfile.php:197
eZPBImageFile
Definition: ezpbimagefile.php:71
$file
$file
Definition: ezfilemanager/user/filedownload.php:35

Definition at line 70 of file ezpbimagefile.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZPBImageFile::__construct | ( |  | ) |

Constructs a new eZPBImageFile object.

Reimplemented from eZPBFile.

Definition at line 75 of file ezpbimagefile.php.

## Member Function Documentation

## ◆ convertCopy()

eZPBImageFile::convertCopy | ( |  | $dest | ) |

Makes a copy of the image if and converts it to the correct image type.

Definition at line 320 of file ezpbimagefile.php.

References $ini, $ret, and eZPBFile\chmod().

## ◆ defaultInformation()

static& eZPBImageFile::defaultInformation | ( |  | ) |
| static

Returns the default image info structure, which uses the jpeg format. This is used for returning a standard info structure if the file format is unsupported.

Definition at line 152 of file ezpbimagefile.php.

References $ret.

Referenced by information().

## ◆ information()

static& eZPBImageFile::information | ( |  | $file,
|  |  | $use_default = `false`
| ) |  |
| static

Returns a information structure of the image file. The structure is an associative array with the following contents: "suffix" - The suffix of the image file, for instance: png, jpg or gif "dot-suffix" - The suffix of the image file with a dot, is empty if not supported. "image-type" - The image type, for instance: image/jpeg, image/png or image/gif "support" - True if the image type is supported.

Definition at line 108 of file ezpbimagefile.php.

References $file, $ret, $suffix, and defaultInformation().

Referenced by eZImageVariation\requestVariation(), and eZImage\setImage().

## ◆ isImage()

eZPBImageFile::isImage | ( |  | ) |

Returns true if the uploaded file is an image (As perceived by Apache). Warning!! Do not use this to figure out if a file is an true image, only to see if Apache can serve it directly.

Definition at line 85 of file ezpbimagefile.php.

References $ret.

## ◆ scaleCopy()

eZPBImageFile::scaleCopy | ( |  | $dest,
|  |  | $width,
|  |  | $height,
|  |  | $convertToGray = `false`,
|  |  | $aspectScale = `true`
| ) |  |

Makes a copy of the image if and scales the copy according to the parameters $width and $height. If $aspectScale is true the scaling is done with ascpect ratio if not it uses "free form" scaling.

Aspect scaling is the default.

Definition at line 168 of file ezpbimagefile.php.

References $height, $i, $ini, $ret, $width, eZPBFile\chmod(), eZPBFile\copy(), eZPBFile\file_exists(), eZPBFile\is_file(), eZPBFile\unlink(), and eZPBLog\writeNotice().

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

- ezpbimagefile.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.