diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2016-04-23 15:05:54 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2016-04-23 15:05:54 +0200 |
commit | ee6efd77f36a31389504c8a535c585a3cf47981d (patch) | |
tree | d2fd66a27d93ac78dfe53cf0056b047f07c6513f | |
parent | cf76a9dfecf0d779d3b5ed0a154b5f77826e2d0a (diff) | |
download | chd_gestion-ee6efd77f36a31389504c8a535c585a3cf47981d.zip chd_gestion-ee6efd77f36a31389504c8a535c585a3cf47981d.tar.gz chd_gestion-ee6efd77f36a31389504c8a535c585a3cf47981d.tar.bz2 |
Bugfix synoptique, svg inline et pas embed + correction chemins images
-rw-r--r-- | api/img_adt_svc_relais.php | 11 | ||||
-rw-r--r-- | generator/after-bake/src/Template/Adherents/view.ctp | 19 |
2 files changed, 28 insertions, 2 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]); diff --git a/generator/after-bake/src/Template/Adherents/view.ctp b/generator/after-bake/src/Template/Adherents/view.ctp index a607038..e93b234 100644 --- a/generator/after-bake/src/Template/Adherents/view.ctp +++ b/generator/after-bake/src/Template/Adherents/view.ctp @@ -230,7 +230,24 @@ </tr> <?php endforeach; ?> </table> - <embed type="image/svg+xml" src="https://priv.chd.sx/api/img_adt_svc_relais.php?a=<?=$adherent->id ?>"</embed> + <div class="synoptique"> + <?php + $url = "https://priv.chd.sx/api/img_adt_svc_relais.php?e=yes&a=" . $adherent->id; + $fh = fopen($url, 'r'); + if ( is_resource($fh) ) { + stream_set_timeout($fh,1); + // Embded SVG here in the html page + $buf=''; + while(!feof($fh) && $buf !== FALSE) { + $buf = fread($fh, 8192); + echo $buf; + } + fclose($fh); + } else { + echo "<pre>Can't fopen '$url'</pre>\n"; + } + ?> + </div> <?php endif; ?> </div> </div> |