diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/img_adt_svc_relais.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/api/img_adt_svc_relais.php b/api/img_adt_svc_relais.php index 4071cfc..201ab9b 100644 --- a/api/img_adt_svc_relais.php +++ b/api/img_adt_svc_relais.php @@ -25,6 +25,7 @@ unset($db_config); $mysqli->query("SET NAMES 'utf8'"); $opt_show_source=array_key_exists('s', $_GET); +$opt_embed=array_key_exists('e', $_GET); $arg_adt=(array_key_exists('a', $_GET) && is_numeric($_GET['a']))?(0+$_GET['a']):NULL; if (!$arg_adt) { @@ -148,8 +149,16 @@ fwrite($fd, "}\n"); if (!$opt_show_source) { fclose($fd); - + if ($opt_embed) { + // Skip <?xml> and <!doctype> + for ($i=0 ; $i<3 && !feof($pipes[1]); $i++) { + fgets($pipes[1]); + } + } $image_data = stream_get_contents($pipes[1]); + if ($opt_embed) { + $image_data = str_replace('image xlink:href="icons', 'image xlink:href="/api/icons', $image_data); + } fclose($pipes[1]); $err_data = stream_get_contents($pipes[2]); fclose($pipes[2]); |