Jelix 1.7.18

jImageModifier
in package

Utility class to manipulate image.

Tags
subpackage

utils

static

Table of Contents

$attributeParams  : array<string|int, mixed>
params associated with html equivalent attributes do not induce any transform of source image.
$mimes  : mixed
$transformParams  : array<string|int, mixed>
params inducing transforms of source image.
computeUrlFilePath()  : array<string|int, mixed>
compute path from the configuration or from the given array. These paths will be used to read images and to save them into a cache directory.
get()  : array<string|int, mixed>
retrieve an image from the combination of a source image and parameters.
transformImage()  : mixed
transform source image file (given parameters) and store the result into an other file.
createShadow()  : resource
create a shadow.

Properties

$attributeParams

params associated with html equivalent attributes do not induce any transform of source image.

protected static array<string|int, mixed> $attributeParams = array('alt', 'class', 'id', 'style', 'longdesc', 'name', 'ismap', 'usemap', 'title', 'dir', 'lang', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup', 'width', 'height')

$mimes

protected static mixed $mimes = array('gif' => 'image/gif', 'png' => 'image/png', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'xpm' => 'image/x-xpixmap', 'xbm' => 'image/x-xbitmap', 'wbmp' => 'image/vnd.wap.wbmp')

$transformParams

params inducing transforms of source image.

protected static array<string|int, mixed> $transformParams = array('width', 'height', 'maxwidth', 'maxheight', 'zoom', 'alignh', 'alignv', 'ext', 'quality', 'shadow', 'scolor', 'sopacity', 'sblur', 'soffset', 'sangle', 'background', 'omo')

Methods

computeUrlFilePath()

compute path from the configuration or from the given array. These paths will be used to read images and to save them into a cache directory.

public static computeUrlFilePath([null|mixed $config = null ][, null|mixed $src = null ]) : array<string|int, mixed>
Parameters
$config : null|mixed = null
$src : null|mixed = null
Return values
array<string|int, mixed>

keys are src_url, src_path, cache_path, cache_url

get()

retrieve an image from the combination of a source image and parameters.

public static get(string $src[, array<string|int, mixed> $params = array() ][, mixed $sendCachePath = true ][, array<string|int, mixed> $config = null ]) : array<string|int, mixed>

parameters list some induce transformations, some not

class :string id :string alt :string width :uint height :uint maxwidth :uint only with maxheight maxheight :uint only with maxwidth zoom 1-100 omo :boolean alignh [left|center|right|:int] alignv [top|center|bottom|:int] ext [png|jpg|gif] quality 0-100 if ext = jpg shadow :boolean soffset :uint sangle :uint sblur :uint sopacity :uint scolor #000000 :string background #000000 :string

gif -> image/gif jpeg -> image/jpeg jpg -> image/jpeg jpe -> image/jpeg xpm -> image/x-xpixmap xbm -> image/x-xbitmap wbmp -> image/vnd.wap.wbmp png -> image/png other -> image/png

Parameters
$src : string

the path to the source image, relative to the www directory or relative to the path indicated into the configuration. The filename should have one of these extensions: gif,jpeg,jpg,jpe,xpm,xbm,wbmp,png

$params : array<string|int, mixed> = array()

parameters specifying image

$sendCachePath : mixed = true
$config : array<string|int, mixed> = null

the paths configuration. should contain same parameters as you find in the imagemodifier section of the configuration. give these array if you want to override the configuration.

Return values
array<string|int, mixed>

list of attributes

transformImage()

transform source image file (given parameters) and store the result into an other file.

public static transformImage(string $srcFs, string $targetPath, string $targetName, array<string|int, mixed> $params) : mixed
Parameters
$srcFs : string

the path to the image to transform. [gif|jpeg|jpg|jpe|xpm|xbm|wbmp|png]

$targetPath : string

the path of the directory to store the resulting image

$targetName : string

the filename of the resulting image

$params : array<string|int, mixed>

parameters specifying transformations

Return values
mixed

createShadow()

create a shadow.

protected static createShadow(mixed $image, array<string|int, mixed> $params) : resource
Parameters
$image : mixed
$params : array<string|int, mixed>

parameters for the url

Return values
resource

the image with shadow

Search results