MLAImageProcessor

Class MLA (Media Library Assistant) Image Processor provides PDF thumbnails for the [mla_gallery] mla_viewer and Media/Assistant thumbnail generator.

package

Media Library Assistant

since 2.10

Methods

Generate a unique, writable file in the temporary directory

_get_temp_file(string $extension = '.tmp') : string
static
since 2.10

Arguments

$extension

string

File extension for the temporary file

Response

string

Writable path and file name.

Direct Ghostscript file conversion

_ghostscript_convert(string $file, string $frame, string $resolution, string $output_type, string $explicit_path = '') : boolean
static
since 2.10
uses

loads the converted file to this Imagick object

Arguments

$file

string

Input file, e.g., a PDF document

$frame

string

Page/frame within the file, zero-based

$resolution

string

Output file DPI. Default 72.

$output_type

string

Output MIME type; 'image/jpeg' or 'image/png'.

$explicit_path

string

Optional. Non-standard location to override default search, e.g., 'C:\Program Files (x86)\gs\gs9.15\bin\gswin32c.exe'

Response

boolean

true if conversion succeeds else false

Log debug information

_mla_debug_add(string $message) 
static
since 2.12

Arguments

$message

string

Error message.

Abort the operation and exit

_mla_die(string $message, string $title = '', integer $response = 500) : void
static
since 2.10

Arguments

$message

string

Error message.

$title

string

Optional. Error title. Default empty.

$response

integer

Optional. HTML response code. Default 500.

Log the message and return error message array

_mla_error_return(string $message, string $line = '') : \array(
static
since 2.10

Arguments

$message

string

Error message.

$line

string

Optional. Line number in the caller.

Response

\array(

'error' => message )

Prepare the image for output, scaling and flattening as required

_prepare_image( $width,  $height,  $best_fit,  $type,  $quality) : void
static
since 2.10
uses

updates the image in this Imagick object

Arguments

$width

$height

$best_fit

$type

$quality

Process Imagick thumbnail conversion request, e.g., for a PDF thumbnail

mla_handle_thumbnail_sideload(string $input_file, array $args) : array
static

Replaces download_url() in the Codex "Function Reference/wp handle sideload" example.

since 2.13

Arguments

$input_file

string

Path and name of the source file relative to upload directory

$args

array

Generation parameters

Response

array

file attributes ( 'file', 'url', 'type' ) on success, ( 'error' ) on failure

Process Imagick image stream request, e.g., for a PDF thumbnail

mla_process_stream_image() : void
static

Requires mla_stream_file (relative to wp_upload_dir ) in $_REQUEST; optional $_REQUEST parameters are: mla_stream_width, mla_stream_height, mla_stream_frame, mla_stream_resolution, mla_stream_quality, mla_stream_type, mla_stream_fit, mla_ghostscript_path

since 2.10

Properties

Log debug information if true

mla_debug : boolean
static
since
var

Type(s)

boolean

Imagick object for the image to be streamed

image : \Imagick
static
since
var

Type(s)

\Imagick