[Clipart] upload.cgi
Jonadab the Unsightly One
jonadab at bright.net
Mon Oct 18 20:12:48 PDT 2004
"Jonadab the Unsightly One" <jonadab at bright.net> writes:
> Bryce Harrington <bryce at bryceharrington.com> writes:
>
>> What occurs if someone wraps a MYFILE.SVG in a zipfile and uploads it?
>
> Currently, the upload script does not look inside archives except to
> find or insert metadata.rdf. This could be changed. It would be
> possible to have the upload script actually do the unpacking, adding
> the embedded metadata, or the metadata specified at upload time, to
> every image, allowing image-specific metadata to override it.
[and then downthread...]
"Jonadab the Unsightly One" <jonadab at bright.net> writes:
> Nicu Buculei <nicu at apsro.com> writes:
>
>> probably is faster to use a separate script, but the feedback is less:
>
> Agreed. Since we don't know how much faster it is, I guess we can't
> make the decision about whether to do the unpacking on the fly at
> upload time until we know how long it takes.
>
> So what we'll do is write a separate script that unpacks them (in a
> metadata-aware fashion), and then after we get a feel for how fast
> it happens, we can decide whether to fold that functionality into
> the upload script or keep it separate.
So I have checked in a new upload script, clipart_web/upload.cgi
To run it you will also want its config file, clipart_web/upload.cfg
This script is based on upload_svg.cgi, but reworked so that it
recursively unpacks zipfiles and tarballs, applying metadata to each
included file. The performance seems reasonable for small archives,
containing only a few files, but I have not tested it extensively.
Currently, if there's a metadata.rdf within a zipfile or tarball, it
is ignored. This is a bug -- there's actually code that's _supposed_
to read that metadata and merge it in, but it's getting an error back
from the parse routine of SVG::Metadata, saying that it can't find an
RDF tag in the file, though there clearly is an rdf:RDF element. I'm
not sure right now whether this is a bug in my script (perhaps parse
can't read the file due to some problem) or in SVG::Metadata. Either
way, I need to isolate and fix it before we can consider this script
production-quality and consider replacing the other one.
Also, someone needs to test it with a larger archive, with a couple
hundred images or so, before I'd be confident replacing upload_svg.cgi
with it. The current system may not be elegant, but it does work.
Also, I'm soliciting comments on the way merging the metadata is
handled. If SVG files contain embedded metadata, this is merged with
the metadata supplied at upload time. The question is, am I
preserving the right things when I do the merge?
So it's not live on the site yet. But it's in CVS. Test away.
I'm going to get some sleep now.
--
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"ten.thgirb\@badanoj$/ --";$\=$ ;-> ();print$/
More information about the clipart
mailing list