Slimore
  • Namespace
  • Class

Namespaces

  • None
  • Slimore
    • Cache
      • Exception
    • Captcha
    • Database
    • Debug
    • Http
    • Image
    • Log
    • Middleware
    • Mvc
    • Pagination
    • Upload

Classes

  • Gd

Class Gd

Class Gd

Namespace: Slimore\Image
Package: Slimore\Image
Author: Pandao
Located at Slimore/Image/Gd.php

Methods summary

public
# __construct( string $src = '' )

Constructor

Constructor

Parameters

$src
public array|string|boolean
# getGDInfo( string $key = null )

Get GD information

Get GD information

Parameters

$key
null

Returns

array|string|boolean
public array
# getImageInfo( string $image )

Get image info array

Get image info array

Parameters

$image

Returns

array
public string
# ext( )

Get image file extension

Get image file extension

Returns

string
public number
# width( )

Get image width

Get image width

Returns

number
public number
# height( )

Get image height

Get image height

Returns

number
public number
# fileSize( )

Get image file size

Get image file size

Returns

number
public string
# getType( string $type )

Get image type for imagecreatefromxxx

Get image type for imagecreatefromxxx

Parameters

$type

Returns

string
public
# source( string $src )

Set local image source

Set local image source

Parameters

$src

Returns


$this
public
# create( integer $width, integer $height, string $type = null )

Create new canvas image

Create new canvas image

Parameters

$width
$height
$type
null

Returns


$this
public mixed
# createFrom( string $image )

Create image from type

Create image from type

Parameters

$image

Returns

mixed
public
# crop( integer $width, integer $height, string $mode = 'tl' )

Crop image file

Crop image file

Parameters

$width
$height
$mode
tl

Returns


$this
public
# thumb( integer $width, integer $height, integer $mode = 0, boolean $amplify = false )

Image thumbnail

Image thumbnail

Parameters

$width
$height
$mode
0
$amplify
false

Returns


$this|bool
public
# resize( integer $width, integer $height, integer $x = 0, integer $y = 0 )

Image resize

Image resize

Parameters

$width
$height
$x
0
$y
0

Returns


$this
public
# resizePercent( integer $percent = 50 )

Image resize by percent

Image resize by percent

Parameters

$percent
50

Returns


$this
public
# watermark( string $water, integer $pos = 0, boolean $tile = false )

Image watermark

Image watermark

Parameters

$water
$pos
0
$tile
false

Returns


$this
public
# watermarkTile( string $water, integer|array $pos = 0 )

Fill watermark tile

Fill watermark tile

Parameters

$water
$pos
0

Returns


$this
public
# watermarkText( string $text, integer|array $pos = 0, integer $fontSize = 14, array $color = null, string $font = null, boolean $shadow = true )

Text watermark for image

Text watermark for image

Parameters

$text
$pos
0
$fontSize
14
$color
null
$font
null
$shadow
true

Returns


$this
public
# setFontFile( string $fontFile )

Set font file (FreeType font)

Set font file (FreeType font)

Parameters

$fontFile

Returns


$this

Throws

InvalidArgumentException
public
# display( string $type = 'jpeg' )

Display on browser

Display on browser

Parameters

$type
jpeg

Returns


$this
public
# save( string $saveName, integer $quality = 80 )

Saved image file

Saved image file

Parameters

$saveName
$quality
80

Returns


$this

Throws

ErrorException
public string
# dataUrl( string $type = 'jpeg' )

Image to data url base64

Image to data url base64

Parameters

$type
jpeg

Returns

string
public
# destroy( resource $resource )

Destroy image resource

Destroy image resource

Parameters

$resource
public
# destroyAll( )

Destroy all image resource

Destroy all image resource

public
# __destruct( )

Destructor

Destructor

Constants summary

integer THUMB_EQUAL_RATIO

Thumbnail modes

Thumbnail modes

# 0
integer THUMB_CENTER_CENTER
# 1
integer THUMB_LEFT_TOP
# 2
string CROP_TOP_LEFT

Crop positions

Crop positions

# 'tl'
string CROP_TOP_CENTER
# 'tc'
string CROP_TOP_RIGHT
# 'tr'
string CROP_CENTER_LEFT
# 'cl'
string CROP_CENTER_CENTER
# 'center'
string CROP_CENTER_RIGHT
# 'cr'
string CROP_BOTTOM_LEFT
# 'bl'
string CROP_BOTTOM_CENTER
# 'bc'
string CROP_BOTTOM_RIGHT
# 'br'
string POS_TOP_LEFT

Watermark positions

Watermark positions

# 'tl'
string POS_TOP_CENTER
# 'tc'
string POS_TOP_RIGHT
# 'tr'
string POS_CENTER_LEFT
# 'cl'
string POS_CENTER_CENTER
# 'center'
string POS_CENTER_RIGHT
# 'cr'
string POS_BOTTOM_LEFT
# 'bl'
string POS_BOTTOM_CENTER
# 'bc'
string POS_BOTTOM_RIGHT
# 'br'
integer POS_RAND
# 0
integer POS_DEFAULT
# 0

Properties summary

public string $source
#
protected string $fontFile
#
protected resource $newImage
#
protected resource $sourceImage
#
protected array $types
# ['gif', 'jpg', 'jpeg', 'png', 'bmp', 'webp']
Slimore API documentation generated by ApiGen