Watimage API
  • Namespace
  • Class

Namespaces

  • Elboletaire
    • Watimage
      • Exception

Classes

  • Image
  • Normalize
  • Watermark
  • Watimage

Class Normalize

The Normalize class. It takes params in a lot of different ways, but it always return our expected params :D

Namespace: Elboletaire\Watimage
Copyright: 2015 Òscar Casajuana
License: MIT
Author: Òscar Casajuana
Link: https://github.com/elboletaire/Watimage
Located at Normalize.php

Methods summary

public static array
# color( mixed $color )

Returns the proper color array for the given color.

Returns the proper color array for the given color.

It accepts any (or almost any) imaginable type.

Parameters

$color

Can be an array (sequential or associative) or hexadecimal. In hexadecimal allows 3 and 6 characters for rgb and 4 or 8 characters for rgba.

Returns

array
Containing all 4 color channels.

Throws

Elboletaire\Watimage\Exception\InvalidArgumentException
public static array
# crop( integer $x, integer $y = null, integer $width = null, integer $height = null )

Normalizes crop arguments returning an array with them.

Normalizes crop arguments returning an array with them.

You can pass arguments one by one or an array passing arguments however you like.

Parameters

$x
X position where start to crop.
$y
Y position where start to crop.
$width
New width of the image.
$height
New height of the image.

Returns

array
Array with numeric keys for x, y, width & height

Throws

Elboletaire\Watimage\Exception\InvalidArgumentException
public static integer
# flip( mixed $type )

Normalizes flip type from any of the allowed values.

Normalizes flip type from any of the allowed values.

Parameters

$type

Can be either: v, y, vertical or IMG_FLIP_VERTICAL h, x, horizontal or IMG_FLIP_HORIZONTAL b, xy, yx, both or IMG_FLIP_BOTH

Returns

integer

Throws

Elboletaire\Watimage\Exception\InvalidArgumentException
public static array
# margin( mixed $x, integer $y = null )

An alias of self::position but returning a customized message for Watermark.

An alias of self::position but returning a customized message for Watermark.

Parameters

$x
Can be just x or an array containing both params.
$y
Can only be y.

Returns

array
With x and y in a sequential array.

Throws

Elboletaire\Watimage\Exception\InvalidArgumentException
public static array
# position( mixed $x, integer $y = null )

Normalizes position (x and y).

Normalizes position (x and y).

Parameters

$x
Can be just x or an array containing both params.
$y
Can only be y.

Returns

array
With x and y in a sequential array.

Throws

Elboletaire\Watimage\Exception\InvalidArgumentException
public static array
# cropMeasures( mixed $ox, integer $oy = null, integer $dx = null, integer $dy = null )

Normalizes cropMeasures (origin X, origin Y, destiny X & destiny Y)

Normalizes cropMeasures (origin X, origin Y, destiny X & destiny Y)

Parameters

$ox
Can be just ox or an array containing all the params.
$oy
Origin Y.
$dx
Destiny X.
$dy
Destiny Y.

Returns

array
public static array
# size( mixed $width, integer $height = null )

Normalizes size (width and height).

Normalizes size (width and height).

Parameters

$width
Can be just width or an array containing both params.
$height
Can only be height.

Returns

array
With width and height in a sequential array.

Throws

Elboletaire\Watimage\Exception\InvalidArgumentException
public static integer
# fitInRange( integer $value, boolean $min = false, boolean $max = false )

Checks that the given value is between our defined range.

Checks that the given value is between our defined range.

Can check just for min or max if setting the other value to false.

Parameters

$value
Value to be checked,
$min
Minimum value. False to just use max.
$max
Maximum value. False to just use min.

Returns

integer
The value itself.
public static mixed
# cssPosition( mixed $position )

Normalizes position + position ala css.

Normalizes position + position ala css.

Parameters

$position
Array with x,y or string ala CSS.

Returns

mixed
Returns what you pass (array or string).

Throws

Elboletaire\Watimage\Exception\InvalidArgumentException
public static mixed
# watermarkSize( mixed $width, integer $height = null )

Returns proper size argument for Watermark.

Returns proper size argument for Watermark.

Parameters

$width
Can be a percentage, just width or an array containing both params.
$height
Can only be height.

Returns

mixed
Watimage API API documentation generated by ApiGen