modulesfeature-upload.php

Functions

get_max_upload_size()

get_max_upload_size() : integer

Calculates the actual maximum upload size supported by the server Returns a file size limit in bytes based on the PHP upload_max_filesize and post_max_size

Returns

integer —

The maximum upload size supported bythe server, in bytes.

parse_size()

parse_size(string  $size) : integer

Parses a PHP size to an integer

Parameters

string $size

The size to parse.

Returns

integer —

The number of bytees represented by the specified size string.

upload_check_svg()

upload_check_svg(string  $temp_filename) : array<mixed,integer>

Checks an uploaded SVG file to make sure it's (at least somewhat) safe.

Sends an error to the client if a problem is found.

Parameters

string $temp_filename

The filename of the SVG file to check.

Returns

array<mixed,integer> —

The size of the SVG image.

getsvgsize()

getsvgsize(string  $svgFilename) : array<mixed,integer>

Calculates the size of the specified SVG file.

Parameters

string $svgFilename

The filename to calculate the size of.

Returns

array<mixed,integer> —

The width and height respectively of the specified SVG file.

errorimage()

errorimage(string  $text, integer  $target_size = null) : \image

Creates an images containing the specified text.

Useful for sending errors back to the client.

Parameters

string $text

The text to include in the image.

integer $target_size

The target width to aim for when creating the image.

Returns

\image —

The handle to the generated GD image.