Watimage API
  • Namespace
  • Class

Namespaces

  • Elboletaire
    • Watimage
      • Exception

Classes

  • Image
  • Normalize
  • Watermark
  • Watimage

Class Watermark

The Watermark class. It extends Image class so you can do anything you can do for images to your watermarks.

Elboletaire\Watimage\Image
Extended by Elboletaire\Watimage\Watermark
Namespace: Elboletaire\Watimage
Copyright: 2015 Òscar Casajuana
License: MIT
Author: Òscar Casajuana Alonso elboletaire@underave.net
Link: https://github.com/elboletaire/Watimage
Located at Watermark.php

Methods summary

public
# __construct( string $file = null, array $options = [] )

Constructor method. You can pass a filename to be loaded by default or load it later with load('filename.ext')

Constructor method. You can pass a filename to be loaded by default or load it later with load('filename.ext')

Parameters

$file
Filepath of the watermark to be loaded.
$options

Array of options to be set, with keys: size, position and/or margin.

Overrides

Elboletaire\Watimage\Image::__construct
public Elboletaire\Watimage\Watermark
# destroy( )

Cleans up everything to start again.

Cleans up everything to start again.

Returns

Elboletaire\Watimage\Watermark

Overrides

Elboletaire\Watimage\Image::destroy
public Elboletaire\Watimage\Watermark
# setPosition( mixed $x, integer $y = null )

Sets the position of the watermark.

Sets the position of the watermark.

Parameters

$x

Can be a position ala CSS, just position X or an array containing both params.

$y
Position Y.

Returns

Elboletaire\Watimage\Watermark
public Elboletaire\Watimage\Watermark
# setSize( mixed $width, integer $height = null )

Sets the size of the watermark.

Sets the size of the watermark.

This method has been added for backwards compatibility. If you wanna resize the watermark you can directly call ->resize from Watermark object.

Parameters

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

Returns

Elboletaire\Watimage\Watermark
public Elboletaire\Watimage\Watermark
# setMargin( mixed $x, integer $y = null )

Sets a margin for the watermark. Useful if you're using positioning ala CSS.

Sets a margin for the watermark. Useful if you're using positioning ala CSS.

Parameters

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

Returns

Elboletaire\Watimage\Watermark
public Elboletaire\Watimage\Image
# apply( Elboletaire\Watimage\Image $image )

Applies the watermark to the given image.

Applies the watermark to the given image.

Parameters

$image
The image where apply the watermark.

Returns

Elboletaire\Watimage\Image

The resulting watermarked Image, so you can do $watermark->apply($image)->generate().

protected array
# calculatePosition( array $metadata )

Calculates the position of the watermark.

Calculates the position of the watermark.

Parameters

$metadata
Image to be watermarked metadata.

Returns

array
Position in array x,y
protected
# calculateSize( array $metadata )

Calculates the required size for the watermark from $this->size.

Calculates the required size for the watermark from $this->size.

Parameters

$metadata
Image metadata

Methods inherited from Elboletaire\Watimage\Image

__destruct(), autoOrientate(), blur(), brightness(), calculateCropMeasures(), classicCrop(), classicResize(), color(), colorize(), contrast(), convenienceFlip(), create(), createResourceImage(), crop(), edgeDetection(), emboss(), fill(), flip(), fromString(), generate(), getImage(), getMetadata(), getMetadataForImage(), getMetadataFromFile(), getMimeFromExtension(), grayscale(), imagecopy(), imagecreate(), load(), meanRemove(), negate(), pixelate(), reduce(), resize(), resizeCrop(), resizeMin(), rotate(), save(), sepia(), setCompression(), setImage(), setQuality(), smooth(), toString(), updateMetadata(), updateSize(), vignette(), vignetteEffect()

Constants summary

Constants inherited from Elboletaire\Watimage\Image

COLOR_TRANSPARENT

Properties summary

protected mixed $size

Size param, used to resize the watermark.

Size param, used to resize the watermark.

#
protected array $margin

Watermark margin.

Watermark margin.

# [0, 0]
protected mixed $position

Position for the watermark.

Position for the watermark.

#

Properties inherited from Elboletaire\Watimage\Image

$compression, $filename, $height, $image, $metadata, $quality, $width

Watimage API API documentation generated by ApiGen