Property | Type | Description | |
---|---|---|---|
$currentDimensions | array | The current dimensions of the image | |
$maxHeight | integer | The maximum height an image can be after resizing (in pixels) | |
$maxWidth | integer | The maximum width an image can be after resizing (in pixels) | |
$newDimensions | array | The new, calculated dimensions of the image | |
$oldImage | resource | The prior image (before manipulation) | |
$options | array | This array contains various options that determine the behavior in various functions throughout the class. Functions note which specific option key / values are used in their documentation | |
$percent | integer | The percentage to resize the image by | |
$workingImage | resource | The working image (used during manipulation) |
Method | Description | |
---|---|---|
__construct ( string $fileName, $options = [], $isDataStream = false ) : GdThumb | Class Constructor | |
__destruct ( ) | Class Destructor | |
adaptiveResize ( $width, $height ) : GdThumb | Adaptively Resizes the Image | |
crop ( integer $startX, integer $startY, integer $cropWidth, integer $cropHeight ) : GdThumb | Vanilla Cropping - Crops from x,y with specified width and height | |
cropFromCenter ( integer $cropWidth, integer $cropHeight = null ) : GdThumb | Crops an image from the center with provided dimensions | |
getCurrentDimensions ( ) | Returns $currentDimensions. | |
getImageAsString ( ) : string | Returns the Working Image as a String | |
getMaxHeight ( ) | Returns $maxHeight. | |
getMaxWidth ( ) | Returns $maxWidth. | |
getNewDimensions ( ) | Returns $newDimensions. | |
getOldImage ( ) | Returns $oldImage. | |
getOptions ( ) | Returns $options. | |
getPercent ( ) | Returns $percent. | |
getWorkingImage ( ) | Returns $workingImage. | |
resize ( integer $maxWidth, integer $maxHeight ) : GdThumb | Resizes an image to be no larger than $maxWidth or $maxHeight | |
resizePercent ( integer $percent ) : GdThumb | Resizes an image by a given percent uniformly | |
rotateImage ( string $direction = 'CW' ) | Rotates image either 90 degrees clockwise or counter-clockwise | |
rotateImageNDegrees ( integer $degrees ) : GdThumb | Rotates image specified number of degrees | |
save ( string $fileName, string $format = null ) : GdThumb | Saves an image | |
setCurrentDimensions ( object $currentDimensions ) | Sets $currentDimensions. | |
setMaxHeight ( object $maxHeight ) | Sets $maxHeight. | |
setMaxWidth ( object $maxWidth ) | Sets $maxWidth. | |
setNewDimensions ( object $newDimensions ) | Sets $newDimensions. | |
setOldImage ( object $oldImage ) | Sets $oldImage. | |
setOptions ( array $options = [] ) | Sets $this->options to $options | |
setPercent ( object $percent ) | Sets $percent. | |
setWorkingImage ( object $workingImage ) | Sets $workingImage. | |
show ( boolean $rawData = false ) : GdThumb | Shows an image |
Method | Description | |
---|---|---|
calcHeight ( integer $width, integer $height ) : array | Calculates a new width and height for the image based on $this->maxWidth and the provided dimensions | |
calcImageSize ( integer $width, integer $height ) | Calculates the new image dimensions | |
calcImageSizePercent ( integer $width, integer $height ) | Calculates new dimensions based on $this->percent and the provided dimensions | |
calcImageSizeStrict ( integer $width, integer $height ) | Calculates new image dimensions, not allowing the width and height to be less than either the max width or height | |
calcPercent ( integer $width, integer $height ) : array | Calculates a new width and height for the image based on $this->percent and the provided dimensions | |
calcWidth ( integer $width, integer $height ) : array | Calculates a new width and height for the image based on $this->maxWidth and the provided dimensions | |
determineFormat ( ) | Determines the file format by mime-type | |
preserveAlpha ( ) | Preserves the alpha or transparency for PNG and GIF files | |
verifyFormatCompatiblity ( ) | Makes sure the correct GD implementation exists for the file type |
public __construct ( string $fileName, $options = [], $isDataStream = false ) : GdThumb | ||
$fileName | string | |
return | GdThumb |
public adaptiveResize ( $width, $height ) : GdThumb | ||
return | GdThumb |
protected calcImageSize ( integer $width, integer $height ) | ||
$width | integer | |
$height | integer |
protected calcImageSizePercent ( integer $width, integer $height ) | ||
$width | integer | |
$height | integer |
protected calcImageSizeStrict ( integer $width, integer $height ) | ||
$width | integer | |
$height | integer |
public cropFromCenter ( integer $cropWidth, integer $cropHeight = null ) : GdThumb | ||
$cropWidth | integer | |
$cropHeight | integer | |
return | GdThumb |
protected determineFormat ( ) |
public getImageAsString ( ) : string | ||
return | string |
protected preserveAlpha ( ) |
public resizePercent ( integer $percent ) : GdThumb | ||
$percent | integer | |
return | GdThumb |
public rotateImage ( string $direction = 'CW' ) | ||
$direction | string |
public rotateImageNDegrees ( integer $degrees ) : GdThumb | ||
$degrees | integer | |
return | GdThumb |
public setCurrentDimensions ( object $currentDimensions ) | ||
$currentDimensions | object |
public setMaxHeight ( object $maxHeight ) | ||
$maxHeight | object |
public setMaxWidth ( object $maxWidth ) | ||
$maxWidth | object |
public setNewDimensions ( object $newDimensions ) | ||
$newDimensions | object |
public setOldImage ( object $oldImage ) | ||
$oldImage | object |
public setOptions ( array $options = [] ) | ||
$options | array |
public setWorkingImage ( object $workingImage ) | ||
$workingImage | object |
protected verifyFormatCompatiblity ( ) |
protected array $currentDimensions | ||
return | array |
protected int $maxHeight | ||
return | integer |
protected int $maxWidth | ||
return | integer |
protected array $newDimensions | ||
return | array |
protected resource $oldImage | ||
return | resource |
protected array $options | ||
return | array |
protected int $percent | ||
return | integer |