38 $result = explode(
',', $uri->path, 2);
45 $metas = explode(
';', $metadata);
46 while (!empty($metas)) {
47 $cur = array_shift($metas);
48 if ($cur ==
'base64') {
52 if (substr($cur, 0, 8) ==
'charset=') {
55 if ($charset !== null) {
58 $charset = substr($cur, 8);
60 if ($content_type !== null) {
69 if ($content_type !== null && empty($this->allowed_types[$content_type])) {
72 if ($charset !== null) {
78 $raw_data = base64_decode(
$data);
82 if ( strlen($raw_data) < 12 ) {
89 if (function_exists(
'sys_get_temp_dir')) {
90 $file = tempnam(sys_get_temp_dir(),
"");
92 $file = tempnam(
"/tmp",
"");
94 file_put_contents(
$file, $raw_data);
95 if (function_exists(
'exif_imagetype')) {
96 $image_code = exif_imagetype(
$file);
98 } elseif (function_exists(
'getimagesize')) {
99 set_error_handler(
array($this,
'muteErrorHandler'));
101 restore_error_handler();
103 if (
$info ==
false) {
106 $image_code =
$info[2];
108 trigger_error(
"could not find exif_imagetype or getimagesize functions", E_USER_ERROR);
110 $real_content_type = image_type_to_mime_type($image_code);
111 if ($real_content_type != $content_type) {
114 if (empty($this->allowed_types[$real_content_type])) {
117 $content_type = $real_content_type;
120 $uri->userinfo = null;
123 $uri->fragment = null;
125 $uri->path =
"$content_type;base64," . base64_encode($raw_data);
muteErrorHandler($errno, $errstr)
Implements data: URI for base64 encoded images supported by GD.
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
doValidate(&$uri, $config, $context)
Validator for the components of a URI for a specific scheme.