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()
boolConvert image to greyscale (black and white) 
ImageSizer::convertToSepia()
boolConvert image to sepia tone 
ImageSizer::croppingValue($cropping)
string boolGiven an unknown cropping value, return the validated internal representation of it 
ImageSizer::croppingValueStr($cropping)
stringGiven an unknown cropping value, return the string representation of it 
ImageSizer::flipBoth()
boolFlip both vertically and horizontally 
ImageSizer::flipHorizontal()
boolFlip image horizontally 
ImageSizer::flipVertical()
boolFlip image vertically 
ImageSizer::getEngine()
ImageSizerEngine nullGet the current ImageSizerEngine 
ImageSizer::getEngineInfo()
arrayGet array of information for all ImageSizer engines (or optionally a specific ImageSizer engine) 
ImageSizer::getEngines()
arrayGet 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 arrayImageInformation from Image Inspector in short form or full RawInfoData 
ImageSizer::getImageType()
None 
ImageSizer::getOptions()
None 
ImageSizer::getWidth()
None 
ImageSizer::imageIsAnimatedGif(mixed $image)
bool nullCheck if GIF-image is animated or not ( 
ImageSizer::imageIsRotated(mixed $image)
bool nullCheck orientation ( 
ImageSizer::imageResetIPTC(mixed $image)
null boolPossibility to clean IPTC data, also for original images ( 
ImageSizer::isModified()
None 
ImageSizer::resize(int $targetWidth)
boolResize the image proportionally to the given width/height
ImageSizer::rotate(int $degrees)
boolRotate image by given degrees 
ImageSizer::setAutoRotation()
None 
ImageSizer::setCropExtra($value)
None 
ImageSizer::setCropping()
None 
ImageSizer::setDefaultGamma()
None 
ImageSizer::setFilename($filename)
$thisSet the filename 
ImageSizer::setFlip($flip)
None 
ImageSizer::setForceEngine($engineName)
$thisForce the use of a specific engine 
ImageSizer::setHidpi()
None 
ImageSizer::setModified($modified)
$thisSet whether a modification was made 
ImageSizer::setOptions(array $options)
$thisSet 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)
stringGiven 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.251