vBulletin v6.0.4

vB_Image_Imagick extends vB_Image
in package

Image class wrapper for Imagick PECL library

Table of Contents

Constants

ALLOW_RANDOM_COLOR  = 8
ALLOW_RANDOM_FONT  = 1
These make up the bit field to enable specific parts of image verification
ALLOW_RANDOM_SHAPE  = 16
ALLOW_RANDOM_SIZE  = 2
ALLOW_RANDOM_SLANT  = 4
GIF  = 1
Global image type defines used by serveral functions
JPG  = 2
PNG  = 3

Properties

$imageinfo  : mixed
$must_convert_types  : array<string|int, mixed>
$options  : array<string|int, mixed>
Options from datastore
$resize_types  : array<string|int, mixed>
$thumb_extensions  : array<string|int, mixed>

Methods

__construct()  : void
Constructor Sets ImageMagick paths to convert and identify
__destruct()  : mixed
__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
bestResize()  : mixed
Attempt to resize file if the filesize is too large after an initial resize to max dimensions or the file is already within max dimensions but the filesize is too large
canThumbnailPdf()  : bool
See function definition in vB_Image
checkInstallation()  : mixed
checkLegacySupportedTypes()  : mixed
compareExtensionToFilesignature()  : mixed
cropImg()  : mixed
Crop the profile image
diagnostics()  : mixed
fetchImageExtensions()  : mixed
fetchImageInfo()  : array<string|int, mixed>
Retrieve info about image
fetchImageInfoForThumbnails()  : mixed
fetchImagetypeFromExtension()  : bool
Checks if supplied extension can be used by fetchThumbnail
fetchMustConvert()  : bool
fetchThumbnail()  : array<string|int, mixed>
Returns an array containing a thumbnail, creation time, thumbnail size and any errors
fileContentIsAnimatedGif()  : mixed
fileIsAnimatedGif()  : mixed
fileLocationIsImage()  : bool
Determine if the given location holds a whitelisted image file. Return false if not an image or not whitelisted.
getConvertTypes()  : mixed
standard getter
getExtensionFromFileheaders()  : mixed
getExtensionMap()  : mixed
standard getter
getImageFromString()  : array<string|int, mixed>
Output an image based on a string
getOrientation()  : mixed
getResizeTypes()  : mixed
standard getter
getThumbExtensions()  : mixed
standard getter
imageThumbnailSupported()  : bool
Determine if the given extension can have an image thumbnail. Basically an alias for isValidThumbnailExtension().
instance()  : object
Select image library
isImageExtension()  : bool
Determine if the given extension should be treated as an image for size $type as far as HTML is concerned. These types also align with the cangetimgattachment permission.
isValidResizeType()  : bool
Checks if supplied extension can be resized into a smaller permanent image, not to be used for PSD, PDF, etc as it will lose the original format
isValidThumbnailExtension()  : bool
Checks if supplied extension can be used by fetchThumbnail
loadFileData()  : mixed
Load information about a file base on the data
loadImage()  : mixed
CALLER MUST CLEAN UP/REMOVE OLD FILE. This is to prevent the image class from removing unknown files that it didn't create.
unloadImage()  : mixed
verifyFileHeadersAndExif()  : bool
Checks for HTML tags that can be exploited via IE, & scripts in exif tags
verifyImageFile()  : bool
Checks for HTML tags that can be exploited via IE, scripts in exif tags, and checks file signature against a whitelist of image signatures (currently only support gif, jpg, bmp, tif, psd)

Constants

ALLOW_RANDOM_COLOR

public mixed ALLOW_RANDOM_COLOR = 8

ALLOW_RANDOM_FONT

These make up the bit field to enable specific parts of image verification

public mixed ALLOW_RANDOM_FONT = 1

ALLOW_RANDOM_SHAPE

public mixed ALLOW_RANDOM_SHAPE = 16

ALLOW_RANDOM_SIZE

public mixed ALLOW_RANDOM_SIZE = 2

ALLOW_RANDOM_SLANT

public mixed ALLOW_RANDOM_SLANT = 4

GIF

Global image type defines used by serveral functions

public mixed GIF = 1

Properties

$imageinfo

public mixed $imageinfo = \null

$must_convert_types

public array<string|int, mixed> $must_convert_types = array()

$options

Options from datastore

public array<string|int, mixed> $options = \null

$resize_types

public array<string|int, mixed> $resize_types = array()

$thumb_extensions

public array<string|int, mixed> $thumb_extensions = array()

Methods

__construct()

Constructor Sets ImageMagick paths to convert and identify

public __construct(mixed $options[, mixed $extras = [] ]) : void
Parameters
$options : mixed
$extras : mixed = []

__destruct()

public final __destruct() : mixed

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__sleep()

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__unserialize()

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

bestResize()

Attempt to resize file if the filesize is too large after an initial resize to max dimensions or the file is already within max dimensions but the filesize is too large

public bestResize(mixed $width, mixed $height) : mixed
Parameters
$width : mixed
$height : mixed

canThumbnailPdf()

See function definition in vB_Image

public canThumbnailPdf() : bool
Return values
bool

checkInstallation()

public static checkInstallation() : mixed

checkLegacySupportedTypes()

public final checkLegacySupportedTypes(mixed $extension) : mixed
Parameters
$extension : mixed

compareExtensionToFilesignature()

public final compareExtensionToFilesignature(mixed $extension, mixed $location) : mixed
Parameters
$extension : mixed
$location : mixed

cropImg()

Crop the profile image

public cropImg(mixed $imgInfo[, mixed $maxwidth = 100 ][, mixed $maxheight = 100 ][, mixed $forceResize = false ]) : mixed
@param 	array $imgInfo contains all the required information
  • filename
  • extension
  • filedata
  • width
  • height
  • x1
  • y1
Parameters
$imgInfo : mixed
$maxwidth : mixed = 100

@param int $maxheight @param bool $forceResize force generation of a new file

$maxheight : mixed = 100
$forceResize : mixed = false
Return values
mixed

array of data with the cropped image info:

  • width
  • height
  • filedata
  • filesize
  • dateline
  • imageerror (not used)
  • filename (not used)

diagnostics()

public static diagnostics() : mixed

fetchImageExtensions()

public final fetchImageExtensions() : mixed

fetchImageInfo()

Retrieve info about image

public fetchImageInfo(mixed $filename) : array<string|int, mixed>
Parameters
$filename : mixed
Return values
array<string|int, mixed>

[0] int width [1] int height [2] string type ('GIF', 'JPEG', 'PNG', 'PSD', 'BMP', 'TIFF',) (and so on) [scenes] int Number of scenes [colorspace] int imagick::COLORSPACE_* constant (e.g. COLORSPACE_RGB, COLORSPACE_sRGB, COLORSPACE_CMYK etc) [bits] int Number of bits per pixel (bit depth) [library] string Library Identifier

fetchImageInfoForThumbnails()

public fetchImageInfoForThumbnails(mixed $filename) : mixed
Parameters
$filename : mixed

fetchImagetypeFromExtension()

Checks if supplied extension can be used by fetchThumbnail

public final fetchImagetypeFromExtension(string $extension) : bool
Parameters
$extension : string

Extension of file

Return values
bool

fetchMustConvert()

public final fetchMustConvert(string $type) : bool
Parameters
$type : string

Type of image from $must_convert_types

Return values
bool

fetchThumbnail()

Returns an array containing a thumbnail, creation time, thumbnail size and any errors

public fetchThumbnail(mixed $filename, mixed $location[, mixed $maxwidth = 100 ][, mixed $maxheight = 100 ][, mixed $quality = 75 ][, mixed $labelimage = false ][, mixed $drawborder = false ][, mixed $jpegconvert = false ][, mixed $sharpen = true ][, mixed $owidth = null ][, mixed $oheight = null ][, mixed $ofilesize = null ]) : array<string|int, mixed>
Parameters
$filename : mixed
$location : mixed
$maxwidth : mixed = 100
$maxheight : mixed = 100
$quality : mixed = 75
$labelimage : mixed = false
$drawborder : mixed = false
$jpegconvert : mixed = false
$sharpen : mixed = true
$owidth : mixed = null
$oheight : mixed = null
$ofilesize : mixed = null
Return values
array<string|int, mixed>

fileContentIsAnimatedGif()

public final fileContentIsAnimatedGif(mixed $filecontent) : mixed
Parameters
$filecontent : mixed

fileIsAnimatedGif()

public final fileIsAnimatedGif(mixed $filename) : mixed
Parameters
$filename : mixed

fileLocationIsImage()

Determine if the given location holds a whitelisted image file. Return false if not an image or not whitelisted.

public final fileLocationIsImage(string $location) : bool
Parameters
$location : string

Full file path

Return values
bool

getConvertTypes()

standard getter

public final getConvertTypes() : mixed
Return values
mixed

array of must conver types

getExtensionFromFileheaders()

public final getExtensionFromFileheaders(mixed $location) : mixed
Parameters
$location : mixed

getExtensionMap()

standard getter

public getExtensionMap() : mixed
Return values
mixed

array of file extension-to-type maps , like 'gif' => "GIF' *

getImageFromString()

Output an image based on a string

public getImageFromString(mixed $string[, mixed $moveabout = true ]) : array<string|int, mixed>
Parameters
$string : mixed
$moveabout : mixed = true
Return values
array<string|int, mixed>

Array containing imageInfo: filedata, filesize, filetype and htmltype

getOrientation()

public final getOrientation(mixed $location) : mixed
Parameters
$location : mixed

getResizeTypes()

standard getter

public final getResizeTypes() : mixed
Return values
mixed

array of resize types

getThumbExtensions()

standard getter

public final getThumbExtensions() : mixed
Return values
mixed

array of thumbnail ext

imageThumbnailSupported()

Determine if the given extension can have an image thumbnail. Basically an alias for isValidThumbnailExtension().

public final imageThumbnailSupported(string $extension) : bool

Mostly for the PDF to image thumbnail handling for imagemagick.

Parameters
$extension : string

File extension, usually from filedata.extension.

Return values
bool

instance()

Select image library

public static instance([mixed $type = 'image' ][, mixed $additionalOptions = array() ]) : object
Parameters
$type : mixed = 'image'
$additionalOptions : mixed = array()
Return values
object

isImageExtension()

Determine if the given extension should be treated as an image for size $type as far as HTML is concerned. These types also align with the cangetimgattachment permission.

public final isImageExtension(string $extension[, string $type = vB_Api_Filedata::SIZE_FULL ]) : bool
Parameters
$extension : string

File extension, usually from filedata.extension.

$type : string = vB_Api_Filedata::SIZE_FULL

One of vB_Api_Filedata::SIZE_X strings

Return values
bool

isValidResizeType()

Checks if supplied extension can be resized into a smaller permanent image, not to be used for PSD, PDF, etc as it will lose the original format

public final isValidResizeType(string $type) : bool
Parameters
$type : string

Type of image from $resize_types

Return values
bool

isValidThumbnailExtension()

Checks if supplied extension can be used by fetchThumbnail

public final isValidThumbnailExtension(string $extension) : bool
Parameters
$extension : string

Extension of file

Return values
bool

loadFileData()

Load information about a file base on the data

public loadFileData(mixed $record[, mixed $type = vB_Api_Filedata::SIZE_FULL ][, mixed $includeData = true ]) : mixed
Parameters
$record : mixed
$type : mixed = vB_Api_Filedata::SIZE_FULL
$includeData : mixed = true
Return values
mixed

array of data, includes filesize, dateline, htmltype, filename, extension, and filedataid

loadImage()

CALLER MUST CLEAN UP/REMOVE OLD FILE. This is to prevent the image class from removing unknown files that it didn't create.

public final loadImage(mixed $location) : mixed
Parameters
$location : mixed

unloadImage()

public final unloadImage() : mixed

verifyFileHeadersAndExif()

Checks for HTML tags that can be exploited via IE, & scripts in exif tags

public verifyFileHeadersAndExif(string $fileContents, string $location) : bool
Parameters
$fileContents : string

Contents of the file e.g. file_get_contents($location)

$location : string

Full filepah

Return values
bool

verifyImageFile()

Checks for HTML tags that can be exploited via IE, scripts in exif tags, and checks file signature against a whitelist of image signatures (currently only support gif, jpg, bmp, tif, psd)

public verifyImageFile(string $fileContents, string $location) : bool
Parameters
$fileContents : string

Contents of the file e.g. file_get_contents($location)

$location : string

Full filepah

Return values
bool

True if nothing was detected, false if headers were not found, throws an exception if possible nasty was detected.


        
On this page

Search results