Documentation

Cache
in package

Static class that resolves image urls and downloads and caches remote images if required.

Table of Contents

$broken_image  : string
The url to the "broken image" used when images can't be loaded
$error_message  : mixed
$_cache  : array<string|int, mixed>
Array of downloaded images. Cached so that identical images are not needlessly downloaded.
$_dompdf  : Dompdf
Current dompdf instance
clear()  : mixed
Unlink all cached images (i.e. temporary images either downloaded or converted)
detect_type()  : mixed
is_broken()  : mixed
resolve_url()  : array<string|int, mixed>
Resolve and fetch an image for use.

Properties

$broken_image

The url to the "broken image" used when images can't be loaded

public static string $broken_image = "data:image/svg+xml;charset=utf8,%3C?xml version='1.0'?%3E%3Csvg width='64' height='64' xmlns='http://www.w3.org/2000/svg'%3E%3Cg%3E%3Crect stroke='%23666666' id='svg_1' height='60.499994' width='60.166667' y='1.666669' x='1.999998' stroke-width='1.5' fill='none'/%3E%3Cline stroke-linecap='null' stroke-linejoin='null' id='svg_3' y2='59.333253' x2='59.749916' y1='4.333415' x1='4.250079' stroke-width='1.5' stroke='%23999999' fill='none'/%3E%3Cline stroke-linecap='null' stroke-linejoin='null' id='svg_4' y2='59.999665' x2='4.062838' y1='3.750342' x1='60.062164' stroke-width='1.5' stroke='%23999999' fill='none'/%3E%3C/g%3E%3C/svg%3E"

$error_message

public static mixed $error_message = "Image not found or type unknown"

$_cache

Array of downloaded images. Cached so that identical images are not needlessly downloaded.

protected static array<string|int, mixed> $_cache = []

$_dompdf

Current dompdf instance

protected static Dompdf $_dompdf

Methods

clear()

Unlink all cached images (i.e. temporary images either downloaded or converted)

public static clear() : mixed
Return values
mixed

detect_type()

public static detect_type(mixed $file[, mixed $context = null ]) : mixed
Parameters
$file : mixed
$context : mixed = null
Return values
mixed

is_broken()

public static is_broken(mixed $url) : mixed
Parameters
$url : mixed
Return values
mixed

resolve_url()

Resolve and fetch an image for use.

public static resolve_url(string $url, string $protocol, string $host, string $base_path, Dompdf $dompdf) : array<string|int, mixed>
Parameters
$url : string

The url of the image

$protocol : string

Default protocol if none specified in $url

$host : string

Default host if none specified in $url

$base_path : string

Default path if none specified in $url

$dompdf : Dompdf

The Dompdf instance

Tags
throws
ImageException
Return values
array<string|int, mixed>

An array with two elements: The local path to the image and the image extension

Search results