XOOPS API 2.5.11 Beta1  UI v0.5
Réalisé par monxoops.fr
Tout Structures de données Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe WideImage

Fonctions membres publiques statiques

static version ()
 
static path ()
 
static checkGD ()
 
static registerCustomMapper ($mapper_class_name, $mime_type, $extension)
 
static load ($source)
 
static loadFromFile ($uri)
 
static loadFromString ($string)
 
static loadFromHandle ($handle)
 
static loadFromUpload ($field_name, $index=null)
 
static createPaletteImage ($width, $height)
 
static createTrueColorImage ($width, $height)
 
static isValidImageHandle ($handle)
 
static assertValidImageHandle ($handle)
 

Champs de données

const SIDE_TOP_LEFT = 1
 
const SIDE_TOP = 2
 
const SIDE_TOP_RIGHT = 4
 
const SIDE_RIGHT = 8
 
const SIDE_BOTTOM_RIGHT = 16
 
const SIDE_BOTTOM = 32
 
const SIDE_BOTTOM_LEFT = 64
 
const SIDE_LEFT = 128
 
const SIDE_ALL = 255
 

Attributs protégés statiques

static $path = null
 

Documentation des fonctions membres

◆ assertValidImageHandle()

static assertValidImageHandle (   $handle)
static

Throws exception if the handle isn't a valid GD resource

Paramètres
mixed$handleThe variable to check

◆ checkGD()

static checkGD ( )
static

Checks whether the gd library is loaded, and throws an exception otherwise

◆ createPaletteImage()

static createPaletteImage (   $width,
  $height 
)
static

Factory method for creating a palette image

Paramètres
int$width
int$height
Renvoie
\WideImage\PaletteImage
+ Voici le graphe d'appel pour cette fonction :

◆ createTrueColorImage()

static createTrueColorImage (   $width,
  $height 
)
static

Factory method for creating a true-color image

Paramètres
int$width
int$height
Renvoie
\WideImage\TrueColorImage
+ Voici le graphe d'appel pour cette fonction :
+ Voici le graphe des appelants de cette fonction :

◆ isValidImageHandle()

static isValidImageHandle (   $handle)
static

Check whether the given handle is a valid GD resource

Paramètres
mixed$handleThe variable to check
Renvoie
bool

◆ load()

static load (   $source)
static

Loads an image from a file, URL, HTML input file field, binary string, or a valid image handle. The image format is auto-detected.

Currently supported formats: PNG, GIF, JPG, BMP, TGA, GD, GD2.

This function analyzes the input and decides whether to use WideImage::loadFromHandle(), WideImage::loadFromFile(), WideImage::loadFromUpload() or WideImage::loadFromString(), all of which you can also call directly to spare WideImage some guessing.

Arrays are supported for upload fields; it returns an array of loaded images. To load only a single image from an array field, use WideImage::loadFromUpload('img', $i), where $i is the index of the image you want to load.

$img = WideImage::load('http://url/image.png'); // image URL $img = WideImage::load('/path/to/image.png'); // local file path $img = WideImage::load('img'); // upload field name $img = WideImage::load(imagecreatetruecolor(10, 10)); // a GD resource $img = WideImage::load($image_data); // binary string containing image data

Paramètres
mixed$sourceFile name, url, HTML file input field name, binary string, or a GD image resource
Renvoie
\WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage

◆ loadFromFile()

static loadFromFile (   $uri)
static

Create and load an image from a file or URL. The image format is auto-detected.

Paramètres
string$uriFile or url
Renvoie
\WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage
+ Voici le graphe d'appel pour cette fonction :

◆ loadFromHandle()

static loadFromHandle (   $handle)
static

Create and load an image from an image handle.

Note: the resulting image object takes ownership of the passed handle. When the newly-created image object is destroyed, the handle is destroyed too, so it's not a valid image handle anymore. In order to preserve the handle for use after object destruction, you have to call \WideImage\Image::releaseHandle() on the created image instance prior to its destruction.

$handle = imagecreatefrompng('file.png'); $image = WideImage::loadFromHandle($handle);

Paramètres
resource$handleA valid GD image resource
Renvoie
\WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage

◆ loadFromString()

static loadFromString (   $string)
static

Create and load an image from a string. Format is auto-detected.

Paramètres
string$stringBinary data, i.e. from BLOB field in the database
Renvoie
\WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage
+ Voici le graphe d'appel pour cette fonction :

◆ loadFromUpload()

static loadFromUpload (   $field_name,
  $index = null 
)
static

This method loads a file from the $_FILES array. The image format is auto-detected.

You only have to pass the field name as the parameter. For array fields, this function will return an array of image objects, unless you specify the $index parameter, which will load the desired image.

Paramètres
$field_nameName of the key in $_FILES array
int$indexThe index of the file to load (if the input field is an array)
Renvoie
\WideImage\Image The loaded image

◆ path()

static path ( )
static

Returns the path to the library

Renvoie
string

◆ registerCustomMapper()

static registerCustomMapper (   $mapper_class_name,
  $mime_type,
  $extension 
)
static

Registers a custom mapper for image loading and saving

Example: \WideImage\WideImage::registerCustomMapper('\WideImage\Mapper\TGA', 'image/tga', 'tga');

Paramètres
string$mapper_class_name
string$mime_type
string$extension
+ Voici le graphe d'appel pour cette fonction :

◆ version()

static version ( )
static

Returns the library version

Renvoie
string The library version

Documentation des champs

◆ $path

$path = null
staticprotected

◆ SIDE_ALL

const SIDE_ALL = 255

◆ SIDE_BOTTOM

const SIDE_BOTTOM = 32

◆ SIDE_BOTTOM_LEFT

const SIDE_BOTTOM_LEFT = 64

◆ SIDE_BOTTOM_RIGHT

const SIDE_BOTTOM_RIGHT = 16

◆ SIDE_LEFT

const SIDE_LEFT = 128

◆ SIDE_RIGHT

const SIDE_RIGHT = 8

◆ SIDE_TOP

const SIDE_TOP = 2

◆ SIDE_TOP_LEFT

const SIDE_TOP_LEFT = 1

◆ SIDE_TOP_RIGHT

const SIDE_TOP_RIGHT = 4

La documentation de cette classe a été générée à partir du fichier suivant :