Dotclear 2.26
Loading...
Searching...
No Matches
imageTools Class Reference

Image manipulations. More...

Public Member Functions

 __construct ()
 
 close ()
 
 loadImage (string $filename)
 
 getW ()
 
 getH ()
 
 memoryAllocate (int $width, int $height, int $bpp=4)
 
 output (string $type='png', ?string $file=null, int $qual=90)
 
 resize ($width, $height, string $mode='ratio', bool $expand=false)
 

Data Fields

 $res
 
 $memory_limit = null
 

Detailed Description

Image manipulations.

Class to manipulate images. Some methods are based on https://dev.media-box.net/big/

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor, no parameters.

Member Function Documentation

◆ close()

close ( )

Close

Destroy image resource

◆ loadImage()

loadImage ( string  $filename)

Load image

Loads an image content in memory and set $res property.

Parameters
string$filenameImage file path

References memoryAllocate().

◆ getW()

getW ( )

Image width

Returns
int Image width

Referenced by resize().

◆ getH()

getH ( )

Image height

Returns
int Image height

Referenced by resize().

◆ memoryAllocate()

memoryAllocate ( int  $width,
int  $height,
int  $bpp = 4 
)

Allocate memory

Parameters
int$widthThe width
int$heightThe height
int$bppThe bits per pixel
Exceptions
Exception

Referenced by loadImage(), and resize().

◆ output()

output ( string  $type = 'png',
?string  $file = null,
int  $qual = 90 
)

Image output

Returns image content in a file or as HTML output (with headers)

Parameters
string$typeImage type (png, jpg, webp or avif)
string | null$fileOutput file. If null, output will be echoed in STDOUT
int$qualJPEG image quality
Returns
mixed

◆ resize()

resize (   $width,
  $height,
string  $mode = 'ratio',
bool  $expand = false 
)

Resize image

Parameters
mixed$widthImage width (px or percent)
mixed$heightImage height (px or percent)
string$modeCrop mode (force, crop, ratio)
boolean$expandAllow resize of image
Returns
true

References getH(), getW(), and memoryAllocate().

Field Documentation

◆ $res

$res

◆ $memory_limit

$memory_limit = null

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