[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/media/ -> TransformationalImageHandler.php (summary)

Base class for handlers which require transforming images in a similar way as BitmapHandler does. This was split from BitmapHandler on the basis that some extensions might want to work in a similar way to BitmapHandler, but for different formats.

File Size: 593 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 19 functions

  normaliseParams()
  extractPreRotationDimensions()
  doTransform()
  getThumbnailSource()
  getClientScalingThumbnailImage()
  transformImageMagick()
  transformImageMagickExt()
  transformCustom()
  getMediaTransformError()
  transformGd()
  escapeMagickProperty()
  escapeMagickInput()
  escapeMagickOutput()
  escapeMagickPath()
  getMagickVersion()
  canRotate()
  autoRotateEnabled()
  rotate()
  mustRender()

Functions
Functions that are not part of a class:

normaliseParams( $image, &$params )   X-Ref

param: File $image
param: array $params Transform parameters. Entries with the keys 'width'
return: bool

extractPreRotationDimensions( $params, $rotation )   X-Ref
Extracts the width/height if the image will be scaled before rotating

This will match the physical size/aspect ratio of the original image
prior to application of the rotation -- so for a portrait image that's
stored as raw landscape with 90-degress rotation, the resulting size
will be wider than it is tall.

param: array $params Parameters as returned by normaliseParams
param: int $rotation The rotation angle that will be applied
return: array ($width, $height) array

doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 )   X-Ref
Create a thumbnail.

This sets up various parameters, and then calls a helper method
based on $this->getScalerType in order to scale the image.

param: File $image
param: string $dstPath
param: string $dstUrl
param: array $params
param: int $flags
return: MediaTransformError|ThumbnailImage|TransformParameterError

getThumbnailSource( $file, $params )   X-Ref
Get the source file for the transform

param: $file File
param: $params Array
return: Array Array with keys  width, height and path.

getClientScalingThumbnailImage( $image, $scalerParams )   X-Ref
Get a ThumbnailImage that respresents an image that will be scaled
client side

param: File $image File associated with this thumbnail
param: array $scalerParams Array with scaler params
return: ThumbnailImage

transformImageMagick( $image, $params )   X-Ref
Transform an image using ImageMagick

This is a stub method. The real method is in BitmapHander.

param: File $image File associated with this thumbnail
param: array $params Array with scaler params
return: MediaTransformError Error object if error occurred, false (=no error) otherwise

transformImageMagickExt( $image, $params )   X-Ref
Transform an image using the Imagick PHP extension

This is a stub method. The real method is in BitmapHander.

param: File $image File associated with this thumbnail
param: array $params Array with scaler params
return: MediaTransformError Error object if error occurred, false (=no error) otherwise

transformCustom( $image, $params )   X-Ref
Transform an image using a custom command

This is a stub method. The real method is in BitmapHander.

param: File $image File associated with this thumbnail
param: array $params Array with scaler params
return: MediaTransformError Error object if error occurred, false (=no error) otherwise

getMediaTransformError( $params, $errMsg )   X-Ref
Get a MediaTransformError with error 'thumbnail_error'

param: array $params Parameter array as passed to the transform* functions
param: string $errMsg Error message
return: MediaTransformError

transformGd( $image, $params )   X-Ref
Transform an image using the built in GD library

This is a stub method. The real method is in BitmapHander.

param: File $image File associated with this thumbnail
param: array $params Array with scaler params
return: MediaTransformError Error object if error occurred, false (=no error) otherwise

escapeMagickProperty( $s )   X-Ref
Escape a string for ImageMagick's property input (e.g. -set -comment)
See InterpretImageProperties() in magick/property.c

param: string $s
return: string

escapeMagickInput( $path, $scene = false )   X-Ref
Escape a string for ImageMagick's input filenames. See ExpandFilenames()
and GetPathComponent() in magick/utility.c.

This won't work with an initial ~ or @, so input files should be prefixed
with the directory name.

Glob character unescaping is broken in ImageMagick before 6.6.1-5, but
it's broken in a way that doesn't involve trying to convert every file
in a directory, so we're better off escaping and waiting for the bugfix
to filter down to users.

param: string $path The file path
param: bool|string $scene The scene specification, or false if there is none
return: string

escapeMagickOutput( $path, $scene = false )   X-Ref
Escape a string for ImageMagick's output filename. See
InterpretImageFilename() in magick/image.c.

param: string $path The file path
param: bool|string $scene The scene specification, or false if there is none
return: string

escapeMagickPath( $path, $scene = false )   X-Ref
Armour a string against ImageMagick's GetPathComponent(). This is a
helper function for escapeMagickInput() and escapeMagickOutput().

param: string $path The file path
param: bool|string $scene The scene specification, or false if there is none
return: string

getMagickVersion()   X-Ref
Retrieve the version of the installed ImageMagick
You can use PHPs version_compare() to use this value
Value is cached for one hour.

return: string Representing the IM version.

canRotate()   X-Ref
Returns whether the current scaler supports rotation.

return: bool

autoRotateEnabled()   X-Ref
Should we automatically rotate an image based on exif

return: bool Whether auto rotation is enabled

rotate( $file, $params )   X-Ref
Rotate a thumbnail.

This is a stub. See BitmapHandler::rotate.

param: File $file
param: array $params Rotate parameters.
return: bool

mustRender( $file )   X-Ref
Returns whether the file needs to be rendered. Returns true if the
file requires rotation and we are able to rotate it.

param: File $file
return: bool



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1