[Clipart] [Cctools-cchost] function for generating png thumbnails from svg files

Roan Horning roan at horning.us
Sun Nov 11 06:20:34 PST 2007


Roan Horning wrote:
> I think it has something to do with the way I'm creating a getID3 object 
> in the CCResampler class.
>   
Okay, apparently I did break my getID3 svgz module--just not enough to 
keep cchost upload validation from working. Not sure exactly what 
happen, but it's fixed. I have put the updated svgz module for getID3 on 
test.openclipart.org.

The CCResampler class will now make a thumbnail for both svg and svgz files.

$mySVG = new CCResampler($pathToSVGfile);
$mySVG->Thumbnail($sizeOfThumbnail);

Caveats: It uses Inkscape to create the thumbnail. The thumbnail will be 
of file type PNG. The thumbnail is saved to the same directory as the 
original file. The name of the thumbnail will be the original file's 
name with its extension (svg or svgz) replaced with 
"-tn$sizeOfThumbnail.png"

Things to do next:

1) Let cchost software know this class exists
2) create/modify the code that deals with the suggested file events 
(upload, modify, delete) to add the creation/modification/deletion of 
thumbnails.
3) modify the thumbnail display code to call the PNG thumbnails
a) Simple Solution: don't check for existence of thumbnail, just call 
default name in <img> tag.
b) Less simple: the display code will have the src attribute of a 
thumbnail <img> tag, call a function that returns the thumbnail if it 
exists, or creates and then returns the thumbnail if it doesn't exist.

Thanks,

Roan



More information about the clipart mailing list