Created
January 25, 2013 17:12
-
-
Save Fil/4636174 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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