php-utils

Images extends Base
in package

Images

This class provides utility functions for working with images using the Imagick extension.

Tags
author

Darknetzz

version
1.0.0
since
1.0.0
license

MIT

example

$image = new Images(); $image->resize('/path/to/image.jpg', 200, 200);

see
https://www.php.net/manual/en/book.imagick.php

Table of Contents

Properties

$author  : mixed
$debug_log  : mixed
$debugger  : mixed
$name  : mixed
$url  : mixed
$vars  : mixed
$verbose  : mixed
$version  : mixed

Methods

__construct()  : mixed
Images constructor.
blur()  : string
Blur an image.
renderImage()  : string
Render an image.
textToImage()  : mixed
Add text to an image.

Properties

$author

public mixed $author = "Darknetzz"

$debug_log

public mixed $debug_log = []

$debugger

public mixed $debugger

$name

public mixed $name = "PHPUtils"

$url

public mixed $url = "https://github.com/Darknetzz"

$vars

public mixed $vars

$verbose

public mixed $verbose = \true

$version

public mixed $version = "1.0.0"

Methods

__construct()

Images constructor.

public __construct() : mixed

Initializes the Images class and checks if the Imagick extension is enabled. If the extension is not enabled, it terminates the script execution.

blur()

Blur an image.

public blur(string $imagePath[, float $radius = 10 ][, float $sigma = 25 ][, int $channel = imagick::CHANNEL_ALL ]) : string
Parameters
$imagePath : string

The path to the image file.

$radius : float = 10

The blur radius.

$sigma : float = 25

The blur sigma.

$channel : int = imagick::CHANNEL_ALL

The channel(s) to apply the blur to.

Tags
throws
ImagickException

If an error occurs while blurring the image.

Return values
string

The path of the blurred image.

renderImage()

Render an image.

public renderImage(string $imagePath[, int $height = 200 ][, int $width = 200 ]) : string
Parameters
$imagePath : string

The path to the image file.

$height : int = 200

The height of the image.

$width : int = 200

The width of the image.

Return values
string

The HTML snippet.

textToImage()

Add text to an image.

public textToImage(string $text, string $imagePath, string $fontPath, int $fontSize, int $x, int $y[, string $color = 'black' ]) : mixed
Parameters
$text : string

The text to add to the image.

$imagePath : string

The path to the image file.

$fontPath : string

The path to the font file.

$fontSize : int

The font size.

$x : int

The x-coordinate of the text position.

$y : int

The y-coordinate of the text position.

$color : string = 'black'

The color of the text.

Tags
throws
ImagickException

If an error occurs while adding the text to the image.


        
On this page

Search results