AbstractGdImage
extends AbstractGdFactory
in package
implements
GdImageInterface
This is a simple GD Image implementation that other GD Image can inherit from.
Table of Contents
Interfaces
- GdImageInterface
Constants
- MAP = [ ["type" => \Samy\Image\Constant\GdImageType::BMP, "load" => "imagecreatefrombmp", "save" => "imagebmp"], //~ ["type" => GdImageType::GIF, "load" => "imagecreatefromgif", "save" => "imagegif"], ["type" => \Samy\Image\Constant\GdImageType::JPEG, "load" => "imagecreatefromjpeg", "save" => "imagejpeg"], ["type" => \Samy\Image\Constant\GdImageType::PNG, "load" => "imagecreatefrompng", "save" => "imagepng"], ["type" => \Samy\Image\Constant\GdImageType::WBMP, "load" => "imagecreatefromwbmp", "save" => "imagewbmp"], ["type" => \Samy\Image\Constant\GdImageType::WEBP, "load" => "imagecreatefromwebp", "save" => "imagewebp"], ["type" => \Samy\Image\Constant\GdImageType::XBM, "load" => "imagecreatefromxbm", "save" => "imagexbm"], ]
Properties
- $image : mixed
- $filename : string
- $temporary : array<string|int, string>
- $type : int
- $updated : bool
Methods
- __destruct() : mixed
- detach() : GdImage
- Separates any underlying resource from the instance.
- getContent() : string
- Retrieve image file content.
- getExtension() : string
- Retrieve image file extension.
- getHeight() : int
- Retrieve image height.
- getImage() : GdImage
- Retrieve resource image.
- getMd5() : string
- Retrieve image md5 hash.
- getMimeType() : string
- Retrieve image mime content-type.
- getSha1() : string
- Retrieve image sha1 hash.
- getSize() : int
- Retrieve image file size.
- getType() : int
- Retrieve image type.
- getWidth() : int
- Retrieve image width.
- hasImage() : bool
- Check if instance has a resource image.
- save() : static
- Save image file.
- withType() : static
- Return an instance with the provided image type.
- addTemporary() : static
- Return an instance with the added temprary filename.
- applySelection() : static
- Apply image selection.
- clearTemporary() : static
- Clear temporary data.
- createImage() : GdImage
- Create blank image.
- getMap() : array<string, string>
- Retrieve image map.
- getRandomFilename() : string
- Retrieve a random temporary filename.
- guardFile() : static
- Guard image file.
- guardImage() : static
- Guard resource image.
- loadImageLocation() : GdImage
- Load image location.
- makeSelection() : GdImage
- Make image selection.
- updateSignal() : static
- Send update signal.
- validateArc() : static
- Return an instance with valid draw arc.
- validateArea() : static
- Return an instance with valid draw area.
- validateBlur() : static
- Return an instance with valid blur filter.
- validateBrightness() : static
- Return an instance with valid brightness filter.
- validateColorize() : static
- Return an instance with valid colorize filter.
- validateContrast() : static
- Return an instance with valid contrast filter.
- validateCopy() : static
- Return an instance with valid copy transform.
- validateCorner() : static
- Return an instance with valid corner transform.
- validatePixelate() : static
- Return an instance with valid pixelate filter.
- validatePolygon() : static
- Return an instance with valid draw polygon.
- validateScatter() : static
- Return an instance with valid scatetr filter.
- validateSelection() : static
- Return an instance with valid selection.
- validateSmooth() : static
- Return an instance with valid smooth filter.
- validateTtf() : static
- Return an instance with valid TTF.
- loadImageFile() : GdImage
- Load image file.
- releaseImage() : static
- Release resource image.
Constants
MAP
private
mixed
MAP
= [
["type" => \Samy\Image\Constant\GdImageType::BMP, "load" => "imagecreatefrombmp", "save" => "imagebmp"],
//~ ["type" => GdImageType::GIF, "load" => "imagecreatefromgif", "save" => "imagegif"],
["type" => \Samy\Image\Constant\GdImageType::JPEG, "load" => "imagecreatefromjpeg", "save" => "imagejpeg"],
["type" => \Samy\Image\Constant\GdImageType::PNG, "load" => "imagecreatefrompng", "save" => "imagepng"],
["type" => \Samy\Image\Constant\GdImageType::WBMP, "load" => "imagecreatefromwbmp", "save" => "imagewbmp"],
["type" => \Samy\Image\Constant\GdImageType::WEBP, "load" => "imagecreatefromwebp", "save" => "imagewebp"],
["type" => \Samy\Image\Constant\GdImageType::XBM, "load" => "imagecreatefromxbm", "save" => "imagexbm"],
]
Properties
$image
protected
mixed
$image
= null
Tags
$filename
private
string
$filename
= ""
$temporary
private
array<string|int, string>
$temporary
= []
$type
private
int
$type
= 0
$updated
private
bool
$updated
= false
Methods
__destruct()
public
__destruct() : mixed
detach()
Separates any underlying resource from the instance.
public
detach() : GdImage
After the instance has been detached, the instance is in an unusable state.
Tags
Return values
GdImagegetContent()
Retrieve image file content.
public
getContent() : string
Tags
Return values
stringgetExtension()
Retrieve image file extension.
public
getExtension() : string
Tags
Return values
stringgetHeight()
Retrieve image height.
public
getHeight() : int
Tags
Return values
intgetImage()
Retrieve resource image.
public
getImage() : GdImage
Tags
Return values
GdImagegetMd5()
Retrieve image md5 hash.
public
getMd5() : string
Tags
Return values
stringgetMimeType()
Retrieve image mime content-type.
public
getMimeType() : string
Tags
Return values
stringgetSha1()
Retrieve image sha1 hash.
public
getSha1() : string
Tags
Return values
stringgetSize()
Retrieve image file size.
public
getSize() : int
Tags
Return values
intgetType()
Retrieve image type.
public
getType() : int
Tags
Return values
intgetWidth()
Retrieve image width.
public
getWidth() : int
Tags
Return values
inthasImage()
Check if instance has a resource image.
public
hasImage() : bool
Return values
boolsave()
Save image file.
public
save(string $Filename) : static
Parameters
- $Filename : string
-
The filename.
Tags
Return values
staticwithType()
Return an instance with the provided image type.
public
withType(int $Type) : static
Parameters
- $Type : int
-
The image type.
Tags
Return values
staticaddTemporary()
Return an instance with the added temprary filename.
protected
addTemporary(string $Filename) : static
Parameters
- $Filename : string
-
The temporary filename.
Return values
staticapplySelection()
Apply image selection.
protected
applySelection(array<string, int> $Selection, GdImage $Image) : static
Parameters
- $Selection : array<string, int>
-
The image selection.
- $Image : GdImage
-
The source image.
Return values
staticclearTemporary()
Clear temporary data.
protected
clearTemporary() : static
Return values
staticcreateImage()
Create blank image.
protected
createImage(int $Width, int $Height) : GdImage
Parameters
- $Width : int
-
The image width.
- $Height : int
-
The image height.
Tags
Return values
GdImagegetMap()
Retrieve image map.
protected
getMap(int $Type) : array<string, string>
Parameters
- $Type : int
-
The image type.
Tags
Return values
array<string, string>getRandomFilename()
Retrieve a random temporary filename.
protected
getRandomFilename(string $Namespace[, string $Extension = "tmp" ]) : string
Parameters
- $Namespace : string
-
The file namespace.
- $Extension : string = "tmp"
-
The file extension.
Return values
stringguardFile()
Guard image file.
protected
guardFile() : static
Tags
Return values
staticguardImage()
Guard resource image.
protected
guardImage() : static
Tags
Return values
staticloadImageLocation()
Load image location.
protected
loadImageLocation(string $Location) : GdImage
Parameters
- $Location : string
-
The image location.
Tags
Return values
GdImagemakeSelection()
Make image selection.
protected
makeSelection(array<string, int> $Selection) : GdImage
Parameters
- $Selection : array<string, int>
-
The image selection.
Return values
GdImageupdateSignal()
Send update signal.
protected
updateSignal() : static
Return values
staticvalidateArc()
Return an instance with valid draw arc.
protected
validateArc(array<string, int> $Arc, bool $WithStyle) : static
Parameters
- $Arc : array<string, int>
-
The draw arc.
- $WithStyle : bool
-
With style key.
Tags
Return values
staticvalidateArea()
Return an instance with valid draw area.
protected
validateArea(array<string, int> $Area) : static
Parameters
- $Area : array<string, int>
-
The draw area.
Tags
Return values
staticvalidateBlur()
Return an instance with valid blur filter.
protected
validateBlur(array<string, int> $Blur) : static
Parameters
- $Blur : array<string, int>
-
The blur filter.
Tags
Return values
staticvalidateBrightness()
Return an instance with valid brightness filter.
protected
validateBrightness(array<string, int> $Brightness) : static
Parameters
- $Brightness : array<string, int>
-
The brightness filter.
Tags
Return values
staticvalidateColorize()
Return an instance with valid colorize filter.
protected
validateColorize(array<string, mixed> $Colorize) : static
Parameters
- $Colorize : array<string, mixed>
-
The colorize filter.
Tags
Return values
staticvalidateContrast()
Return an instance with valid contrast filter.
protected
validateContrast(array<string, int> $Contrast) : static
Parameters
- $Contrast : array<string, int>
-
The contrast filter.
Tags
Return values
staticvalidateCopy()
Return an instance with valid copy transform.
protected
validateCopy(array<string, mixed> $Copy) : static
Parameters
- $Copy : array<string, mixed>
-
The copy transform.
Tags
Return values
staticvalidateCorner()
Return an instance with valid corner transform.
protected
validateCorner(array<string, int> $Corner) : static
Parameters
- $Corner : array<string, int>
-
The corner transform.
Tags
Return values
staticvalidatePixelate()
Return an instance with valid pixelate filter.
protected
validatePixelate(array<string, mixed> $Pixelate) : static
Parameters
- $Pixelate : array<string, mixed>
-
The pixelate filter.
Tags
Return values
staticvalidatePolygon()
Return an instance with valid draw polygon.
protected
validatePolygon(array<string, mixed> $Polygon) : static
Parameters
- $Polygon : array<string, mixed>
-
The draw polygon.
Tags
Return values
staticvalidateScatter()
Return an instance with valid scatetr filter.
protected
validateScatter(array<string, mixed> $Scatter) : static
Parameters
- $Scatter : array<string, mixed>
-
The scatetr filter.
Tags
Return values
staticvalidateSelection()
Return an instance with valid selection.
protected
validateSelection(array<string, int> $Selection) : static
Parameters
- $Selection : array<string, int>
-
The selection.
Tags
Return values
staticvalidateSmooth()
Return an instance with valid smooth filter.
protected
validateSmooth(array<string, int> $Smooth) : static
Parameters
- $Smooth : array<string, int>
-
The smooth filter.
Tags
Return values
staticvalidateTtf()
Return an instance with valid TTF.
protected
validateTtf(array<string, mixed> $Ttf, bool $WithEngrave) : static
Parameters
- $Ttf : array<string, mixed>
-
The TTF.
- $WithEngrave : bool
-
With engrave key.
Tags
Return values
staticloadImageFile()
Load image file.
private
loadImageFile(string $Filename) : GdImage
Parameters
- $Filename : string
-
The image filename.
Tags
Return values
GdImagereleaseImage()
Release resource image.
private
releaseImage() : static