[pmwiki-users] SVG cookbook: not displayed when Attach:file.svg is inside hyperlink

Petko Yotov 5ko at 5ko.fr
Wed Mar 16 16:25:34 CDT 2016


Gilles is right, the function that links embedded pictures needs to know 
that the link text is actually a picture. Something like this in 
config.php should do the trick:

   $ImgExtPattern="\\.(?:gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG|SVGZ?|svgz?)";

(This will also work with compressed SVG files.)

Incidentally, if you enable this in config.php, you no longer need the 
recipe, you can remove cookbook/svg.php and the svg file will display 
fine with the <img/> tag (core PmWiki) instead of the <embed/> tag 
(recipe).

I believe at some point more browsers supported SVGs with the <embed/> 
tag. But today all current versions of the browsers, and older versions 
released as early as 5 years ago, can display SVG pictures with the 
<img/> tag:

   http://caniuse.com/#feat=svg-img

I think about adding SVG(Z) as an embeddable image extension to the 
core. Anyone sees a reason not to?

Petko

---
Change log     :  http://www.pmwiki.org/wiki/PmWiki/ChangeLog
Release notes  :  http://www.pmwiki.org/wiki/PmWiki/ReleaseNotes
If you upgrade :  http://www.pmwiki.org/wiki/PmWiki/Upgrades


On 2016-03-16 17:56, Jo Vermeulen wrote:
> Hi,
> 
> I'm having some difficulties displaying SVG's inline, when they're also
> linked. I have installed the SVG cookbook, and made the necessary 
> changes
> to config.php.
> 
> My markup used to look like this:
> 
> [[http://www.example.com/ | Attach:icon.png]]
> 
> I want to replace this by
> 
> [[http://www.example.com/ | Attach:icon.svg]]
> 
> The SVG displays fine if I don't include it in a link (i.e.,
> Attach:icon.svg), but just displays the linked Attach:icon.svg text 
> when
> it's inside a link.



More information about the pmwiki-users mailing list