ImageSizer class

ImageSizer handles resizing of a single JPG, GIF, or PNG image using GD2

or another supported and configured engine. (Imagick, ImageMagick, Netpbm)

Code for IPTC, auto rotation and sharpening by Horst Nogajski.

Other user contributions as noted.

Copyright (C) 2016-2019 by Horst Nogajski and Ryan Cramer This file licensed under Mozilla Public License v2.0 2.0">http://mozilla.org/MPL/2.0


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the ImageSizer class also inherits all the methods and properties of: Wire.

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
ImageSizer::convertToGreyscale()
bool

Convert image to greyscale (black and white)

 
ImageSizer::convertToSepia()
bool

Convert image to sepia tone

 
ImageSizer::croppingValue($cropping)
string bool

Given an unknown cropping value, return the validated internal representation of it

 
ImageSizer::croppingValueStr($cropping)
string

Given an unknown cropping value, return the string representation of it

 
ImageSizer::flipBoth()
bool

Flip both vertically and horizontally

 
ImageSizer::flipHorizontal()
bool

Flip image horizontally

 
ImageSizer::flipVertical()
bool

Flip image vertically

 
ImageSizer::getEngine()
ImageSizerEngine null

Get the current ImageSizerEngine

 
ImageSizer::getEngineInfo()
array

Get array of information for all ImageSizer engines (or optionally a specific ImageSizer engine)

 
ImageSizer::getEngines()
array

Get array of all available ImageSizer engine names in order of priority

 
ImageSizer::getExtension()
None 
ImageSizer::getFailedEngineNames()
None 
ImageSizer::getFilename()
None 
ImageSizer::getHeight()
None 
ImageSizer::getImageInfo()
string array

ImageInformation from Image Inspector in short form or full RawInfoData

 
ImageSizer::getImageType()
None 
ImageSizer::getOptions()
None 
ImageSizer::getWidth()
None 
ImageSizer::imageIsAnimatedGif(mixed $image)
bool null

Check if GIF-image is animated or not (

 
ImageSizer::imageIsRotated(mixed $image)
bool null

Check orientation (

 
ImageSizer::imageResetIPTC(mixed $image)
null bool

Possibility to clean IPTC data, also for original images (

 
ImageSizer::isModified()
None 
ImageSizer::resize(int $targetWidth)
bool

Resize the image proportionally to the given width/height

ImageSizer::rotate(int $degrees)
bool

Rotate image by given degrees

 
ImageSizer::setAutoRotation()
None 
ImageSizer::setCropExtra($value)
None 
ImageSizer::setCropping()
None 
ImageSizer::setDefaultGamma()
None 
ImageSizer::setFilename($filename)
$this

Set the filename

 
ImageSizer::setFlip($flip)
None 
ImageSizer::setForceEngine($engineName)
$this

Force the use of a specific engine

 
ImageSizer::setHidpi()
None 
ImageSizer::setModified($modified)
$this

Set whether a modification was made

 
ImageSizer::setOptions(array $options)
$this

Set multiple resize options

 
ImageSizer::setQuality($n)
None 
ImageSizer::setRotate($degrees)
None 
ImageSizer::setScale($scale)
None 
ImageSizer::setSharpening($value)
None 
ImageSizer::setTimeLimit()
None 
ImageSizer::setUpscaling()
None 
ImageSizer::setUseUSM()
None 
ImageSizer::sharpeningValueStr($value)
string

Given an unknown sharpening value, return the string representation of it

 

Additional methods and properties

In addition to the methods and properties above, ImageSizer also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.252