// Read in file binary data
$handle =
fopen($path, 'rb'
);
$data =
fread($handle,
filesize($path));
fclose($handle);
// Encode as base64
$data =
base64_encode($data);
// Figure out the type (Hail Mary to JPEG)
$mime ??= Mimes::
guessTypeFromExtension(pathinfo($path, PATHINFO_EXTENSION
)) ?? 'image/jpg';
return 'data:' .
$mime . ';base64,' .
$data;
}}if (!
function_exists('doctype'
)) { /**
* Doctype
*
* Generates a page document type declaration
*
* Examples of valid options: html5, xhtml-11, xhtml-strict, xhtml-trans,
* xhtml-frame, html4-strict, html4-trans, and html4-frame.
* All values are saved in the doctypes config file.
*
* @param string $type The doctype to be generated
*/