Gist 4636174
✓ Published0🌍 Public
PPhilippe Rivière
Last edited Jan 25, 2013
Created on Jan 25, 2013
This example demonstrates a web service that converts an SVG file, passed by URL, into a PNG image. The code first validates the incoming `url` parameter against an HTTP/HTTPS pattern ending in `.svg`, then downloads the file locally. It relies on the `rsvg-convert` command-line tool to perform the rasterization, with ImageMagick’s `convert` as an alternate. The resulting PNG is streamed back to the client with the appropriate `Content-Type` header, and temporary files are cleaned up. The script integrates with the SPIP framework, using its `inc/distant` and `abstract_sql` includes for remote file handling.
AI-generated description