Skip to content

Instantly share code, notes, and snippets.

@Fil
Created Jan 25, 2013
Embed
What would you like to do?
<?php
## Service Web de conversion d'un SVG (passéen URL) en png
## ?url=http://......./svg2png.php?url=(adresse du svg)
## renvoie le png converti
## TODO : gestion d'entete en cas d'erreur quelconque
## utilise : SPIP
## utilise : rsvg ou ImageMagick http://seenthis.net/messages/86415
include 'ecrire/inc_version.php';
include_spip('inc/distant');
include_spip('base/abstract_sql');
if ($u = _request('url')
AND preg_match(',^https?://.*svg$,i', $u)
AND $l = copie_locale($u)) {
# rsvg
`rsvg-convert $l -o $l.png`;
# convert ?
# `convert $l $l.png`;
header('Content-Type: image/png');
readfile("$l.png");
@unlink($l);
@unlink("$l.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment