Differences between revisions 6 and 7
Revision 6 as of 2005-03-06 02:57:54
Size: 4424
Editor: r220-101-101-82
Comment:
Revision 7 as of 2005-03-06 19:27:56
Size: 4441
Comment: -
Deletions are marked like this. Additions are marked like this.
Line 70: Line 70:
 Here you find the mozilla firefox [http://www.mozilla.org/projects/svg/ plugin] and on this [http://www.lmtm.de/info/svg.html table] you get more information about svg plugins generally. What's I am interested be on is ( I can check this myself next week ) what happens if a svg file is shown by ImageLink and konqueror with the ksvg plugin. I don't know what internetexplorer shows as error so please give me a note on my homepage describing this. If the problem is that's svg do not belong to the type of files which could be shown on pages directly better we should think on changing this rule in {{{isPicture(url):}}} of wikiutil.py -- ReimarBauer [[DateTime(2005-03-05T09:00:01Z)]]  Here you find the [http://www.mozilla.org/projects/svg/ mozilla firefox with SVG native support] and on this [http://www.lmtm.de/info/svg.html table] you get more information about svg plugins generally. What's I am interested be on is ( I can check this myself next week ) what happens if a svg file is shown by ImageLink and konqueror with the ksvg plugin. I don't know what internetexplorer shows as error so please give me a note on my homepage describing this. If the problem is that's svg do not belong to the type of files which could be shown on pages directly better we should think on changing this rule in {{{isPicture(url):}}} of wikiutil.py -- ReimarBauer [[DateTime(2005-03-05T09:00:01Z)]]

TableOfContents

svg

PURPOSE

This macro is used to enable an attached SVG image to be displayed in a browser. Optionally, the size of the image can be adjusted.

CALLING SEQUENCE

[[svg(attachment[,width=width,[height=height]])]]

INPUTS

attachment:name of SVG attachment

KEYWORD PARAMETERS

width: width of the embedded image (default is 100%)
height: height of the embedded image (default is 100%)

OUTPUT

The svg macro will output an <object> tag as follows:

<object type="image/svg+xml" data="...url-of-attachment..." width="..." height="...">Your browser cannot display SVG</object>

WARNING

You will need Internet Explorer and the [http://www.adobe.com/support/downloads/product.jsp?product=46&platform=Windows Adobe SvgViewer plugin] before SVG content can be seen. Mozilla and Firefox, as at 2005, are not up to it. Who knows about the others.

EXAMPLE

[[svg(plot.svg]]
[[svg(plot.svg,width=800,height=600)]]
[[svg(plot.svg,width=50%)]]

svg(plot.svg)

PROCEDURE

This routine requires attachments enabled. If the attachment is not already present on the wiki then the attachment upload page is shown allowing you to upload the missing attachment.

You must map the mimetype "image/svg+xml" to the .svg and .svgz extensions - either in your web server configuration - Python will automatically add the mimetypes found in the following files:

     "/etc/mime.types",
     "/usr/local/etc/httpd/conf/mime.types",
     "/usr/local/lib/netscape/mime.types",
     "/usr/local/etc/httpd/conf/mime.types",     # Apache 1.2
     "/usr/local/etc/mime.types",                # Apache 1.3
  • ..but "image/svg+xml" is most likely not already defined in any of them.

- or by adding the following lines to wikiconfig.py:

  import mimetypes
  mimetypes.add_type("image/svg_xml", ".svg", True)
  mimetypes.add_type("image/svg_xml", ".svgz", True)

- or by some other method that I am not aware of.

This macro must be put in "[yourwiki]/data/plugin/macro/"

MODIFICATION HISTORY

@copyright: none BR @license: GNU GPL, see COPYING for details. BR

AndrewArmstrong: 2005-03-04 BR Initial version by: andrew_armstrong AT unwired DOT com DOT au

Discussion

  • Here you find the [http://www.mozilla.org/projects/svg/ mozilla firefox with SVG native support] and on this [http://www.lmtm.de/info/svg.html table] you get more information about svg plugins generally. What's I am interested be on is ( I can check this myself next week ) what happens if a svg file is shown by ImageLink and konqueror with the ksvg plugin. I don't know what internetexplorer shows as error so please give me a note on my homepage describing this. If the problem is that's svg do not belong to the type of files which could be shown on pages directly better we should think on changing this rule in isPicture(url): of wikiutil.py -- ReimarBauer DateTime(2005-03-05T09:00:01Z)

    Sorry I don't know about konqueror or ksvg. When using ImageLink to display svg it just displays a box with a red 'X' in it - the same as it does when you code ImageLink(not_an_image.txt).

    The html <img> tag cannot be used for svg even though the mimetype starts with 'image', so changing isPicture is no help (I already tried it). The only way I know is to use the <object> tag (or the deprecated <embed> tag). I think that changing send_viewfile in AttachFile.py to support svg attachments may be handy...that way the attachment 'view' function would work for svg attachments (as is done for images now). Code something like the following could be added:

if type[:13] == 'image/svg+xml':
    timestamp = htdocs_access(request) and "?%s" % time.time() or ''
    request.write('<object type="image/svg+xml" data="%s%s" width="100%%" height="100%%">%s</object>' % (
        getAttachUrl(pagename, filename, request, escaped=1), timestamp, wikiutil.escape(filename, 1)))
    return
elif type[:5] == 'image':
    timestamp = htdocs_access(request) and "?%s" % time.time() or ''
    request.write('<img src="%s%s" alt="%s">' % (
        getAttachUrl(pagename, filename, request, escaped=1), timestamp, wikiutil.escape(filename, 1)))
    return
elif type[:4] == 'text':
    .
    .

-- AndrewArmstrong DateTime(2005-03-06T13:54:00Z+10)

MoinMoin: MacroMarket/Svg (last edited 2011-01-27 15:23:18 by MikeBattistella)