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

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

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

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

since 2.13

Parameters

$input_file

string

Path and name of the source file relative to upload directory

$args

array

Generation parameters

Returns

arrayfile 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

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

Generate a unique, writable file in the temporary directory

_get_temp_file(string $extension) : string

since 2.10

Parameters

$extension

string

File extension for the temporary file

Returns

stringWritable path and file name.

Direct Ghostscript file conversion

_ghostscript_convert(string $file, string $frame, string $resolution, string $output_type, string $explicit_path) : boolean

since 2.10
uses \global\self::$image

Parameters

$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'

Returns

booleantrue if conversion succeeds else false

Log debug information

_mla_debug_add(string $message) 

since 2.12

Parameters

$message

string

Error message.

Abort the operation and exit

_mla_die(string $message, string $title, integer $response) : void

since 2.10

Parameters

$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(

since 2.10

Parameters

$message

string

Error message.

$line

string

Optional. Line number in the caller.

Returns

\array('error' => message )

Prepare the image for output, scaling and flattening as required

_prepare_image(integer $width, integer $height, boolean $best_fit, string $type, integer $quality) : void

since 2.10
uses \global\self::$image

Parameters

$width

integer

zero or new width

$height

integer

zero or new height

$best_fit

boolean

proportional fit (true) or exact fit (false)

$type

string

output MIME type

$quality

integer

compression quality; 1 - 100

 Properties

 

Log debug information if true

$mla_debug : boolean

since 2.12
 

Imagick object for the image to be streamed

$image : \Imagick

since 2.10