Menu

Tree [071f5a] default tip /
 History

Read Only access


File Date Author Commit
 dom 2008-12-15 m0p m0p [a71b81] caching xpath queries statically is not very sm...
 include 2008-12-15 m0p m0p [a71b81] caching xpath queries statically is not very sm...
 .hgtags 2011-03-30 convert-repo convert-repo [071f5a] update tags
 LICENSE 2006-03-20 m0p m0p [ceec47] Initial revision
 README 2006-03-20 m0p m0p [bcc3ce] README (!)
 REQUIREMENTS 2006-03-20 m0p m0p [4d271d] mop: well...requirements
 klecks.inc.php 2008-10-29 m0p m0p [7deaa5] mop: quick and dirty image implementation
 svg_converter.php 2006-08-17 m0p m0p [5ad634] mop: VERY (!) basic css parser...

Read Me

About this project:

Well...My problem was simple: How do i convert SVG images on demand in a php
environment?

As there was no native solution to this problem i had to choose between several
external solutions.

Solution 1:

batik (http://xml.apache.org/batik)

Those of you who are a bit experienced using SVGs will surely know batik. It is
probably the BEST (!) SVG implementation out there. Unfortunately it is written
in java ;). Using this in the PHP worl is a bit problematic:

exec("java -jar batik-rasterizer.jar test.svg");

This is not a useable solution as the java VM takes way too much time to start
and consumes too much memory to be an appropriate solution (especially for on
demand converting).

Solution 2:

using batik as a service in the background
(http://www.gocept.com/open_source_software/BatikServer)

Well sounds good but unfortunately it is not really working as java consumes
more and more memory (by design) until it finally fails and restarts its
service. As you might guess this solution was far away from being the solution.

Solution 3:

ImageMagick

ImageMagick is a nice graphics suite and it even has a php extension.
Unfortunately the SVG support is VERY limited and the extension is somewhat
unstable AND unmaintained.

Solution 4:

Using some C implementation

There are some VERY good implementations out there. One is librsvg and another
implementation is ksvg. Unfortunately these libraries would add many non-web
dependencies to a pure webserver which is not really desired :|

--------

Well...These were the solutions i found and none of them was really fitting my
needs. So i decided to try my own solution: a native php solution.

Of course it adds some new dependencies but it is a NATIVE solution to the
problem and thus a very fine ;).

It is far away from being completed but it should work in some (my SVGs work :P)
cases.

Probably the W3C will hate me as most of the stuff i did is very far away from
being compatible to the spec but as i said: It works for me ;)