[Clipart] function for generating png thumbnails from svg files

Roan Horning roan at horning.us
Sat Nov 3 22:21:42 PDT 2007


I've written a php function that uses inkscape's command line interface 
to generate a png thumbnail of an svg file.

The function takes a filename, and thumbnail size as arguments, and then 
generates a png file.

Either the height or width of the thumbnail will be set to the thumbnail 
size argument. This is determined by whichever side is larger in the svg 
file. Inkscape scales an image proportionately when given the output 
size for only one side of an image. While the function won't create 
perfectly square thumbnails, it will guarantee that all thumbnails of 
the same size will fit into the same area.

I've seen some conversation in the lists about generating and keeping 
thumbnails on upload. Is this what we want to do, or do we want to 
generate them on the fly (maybe using some kind of cache to keep the 
processor overhead down)? If we are going to do it on upload, where is 
the best place in the code to call this function?



More information about the clipart mailing list