Extension talk:Inline SVG

From MediaWiki.org
Jump to: navigation, search

Contents

[edit] Making it appear in Special:Version

Add this to the code:

// Extension credits that show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'Inline_SVG',
        'author' => 'Assela Pathirana',
        'url' => 'http://www.mediawiki.org/wiki/Extension:Inline_SVG',
        'description' => 'Allows the display of SVG files.'
);

--Michael Alabastro

[edit] Problem with links

I have the inline SVG working well, but am having problems with the links. I am trying to create an image map type diagram which will link to other wiki pages.

But all the links (absolute) open up in the svgcode window. Is there anyway I can get them to open in the full window.

Many thanks

--Markemark2 08:34, 23 November 2007 (UTC)Mark

Fixed, I just needed to add target=_parent to my SVG code. --Mark 08:43, 23 November 2007 (UTC)

[edit] Transform into PNG

The Browsers do not accept SVG, so I would like to transform the SVG image into a PNG image and display the PNG-File.

I tried it by changing the sourcecode of Extension inline svg in the following way

 [...]
                fclose($ptr);
  } 
 
  $params['width']=$boxwidth;
  $params['height']=$boxheight;
 
  $image = UnregisteredLocalFile::newFromPath($pname,'image/svg');
  $handler = MediaHandler::getHandler('image/svg');
 
  $handler->normaliseParams(  $image ,$params );
 
  $thumb = $handler->getTransform ( $image ,$path,$IP.$path.$hash.".png",$params ) ;
 
  $txt  = "<a href=$pname><img src=\"".$path.$hash.".png"."\"  width='".$boxwidth."' height='".$boxheight."' ></a>";
  return $txt;
}

instead of

  [...]
                fclose($ptr);
  } 
  $txt  = "<iframe src=$pname width='".$boxwidth."' height='".$boxheight."' ></iframe>";
  return $txt;
}

but the image is not transformed. - I do not find the .png file.

[edit] Security risk

I am not sure about the warning about security, what's the difference between inline or a svg file? E.g. wikipedia allow SVG uploads. (IMHO) --Lastwebpage 00:08, 26 April 2011 (UTC)

[edit] Wiki SVG code editor

I think inline SVG code is a nice addition to Wiki, but the problem is inline code will complicate the syntax of the article page. This will reduce editing accessibility to rookie editor.

Instead I would like to ask if it's possible to invent an "edit SVG code" function to SVG file description page or just add a new namespace for storing code of a SVG image. The advantages of this function are: 1) easier management, if a SVG image is constantly vandalized admin can just protect it. 2) Since different website, browser or SVG tools applied different SVG renderers, meaning the rendering result can be different from 1 engine to another, allow editing code of the SVG file in Wiki means we can also instantly preview the image rendered by SVG renderer of Wiki. Without this function I have to upload the SVG again and again just for a perfect positioning of text.

I know there's Extension:AnyWikiDraw but editing code is prefered for accuracy. Of course adapting AnyWikiDraw into Wiki SVG code editor is also a good idea. -- Sameboat 02:13, 9 June 2011 (UTC)

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox