[Clipart] Make thumbnails work on openclipart.org
Frederik Elwert
frederik.elwert at web.de
Thu Mar 1 10:18:08 PST 2007
Am Mittwoch, den 28.02.2007, 12:50 -0800 schrieb Jon Phillips:
> > There are two problems that prevent the correct display if the
> > thumbnails. First, the thumbnails are embedded by <img> elements. But
> > currently most browsers don't support SVGs as source for imgs. So the
> > script replaces the img with an object.
>
> Is there a generic way to embed all types of media, including images, in
> html? The current way cchost trys to deal with thumbnails is by cramming
> whatever file has been uploaded, into the <img src="" />
<object> is meant for that. As far as I know, <img> is somewhat
deprecated in new versions of XHTML - it's still there, but object is
preferable because it can be used in a wider range of cases.
The problem is, as usual, browser implementations. IE (even 7) doesn't
support images in object at all. Opera and Gecko-Browsers can display
image data inside of objects.
You can test yourself, if you want. I set up two test pages for display
of SVG and PNG in different ways:
http://www-user.uni-bremen.de/~felwert/svg.html
http://www-user.uni-bremen.de/~felwert/png.html
> > Second, most SVGs on openclipart.org don't have a viewBox attribute, so
> > they don't get scaled to fit the thumbnail size. (This may be because
> > Inkscape currently lacks a GUI to set a viewBox, although this would be
> > quite useful for cliparts). So the script sets a viewBox if it is
> > missing, and replaces the absolute width and height values with 100%.
>
> Cool...Inkscape sets the viewBox to the canvas size now. So, I think for
> our purposes, all we would need to do on our side is open and save our
> current collection to fix this.
Oh, that's a big plus! But there is still one problem remaining: for
Opera, it's enough to have a viewBox present to scale the SVG to the
object's dimensions. But Firefox will only scale when no fixed values
for width and height are set. That's why the script sets them to 100%.
So unfortunately there would have to be an option in Inkscape whether to
save the image with fixed dimensions (e.g., for whole pages and things
like that) or with variable dimensions (e.g., clipart) - At least if
Gecko-based browsers are supposed to scale the clipart thumbnails.
> Thanks Frederick! THis is cool...and hopefully we can get you involved
> in other activities here...what areas of the project might I interest
> you in?
Thanks for the invitation! :-) Unfortunately, I have very little time to
spend at the moment. But maybe I can help out later in the year, when I
passed my M.A. exams.
Regards,
Frederik
More information about the clipart
mailing list