Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVG image blur on Firefox

Tags:

css

firefox

svg

I am trying to blur an image on Firefox using the SVG technique proposed here.

However this very simple example is not working on Firefox (I am version 25) JSFiddle.

HTML

<img class="blur" src="http://css-plus.com/examples/2012/03/gaussian-blur/i/fence.jpg" />

CSS

.blur {
    filter: url("http://d2oujmlvvb0w9i.cloudfront.net/images/v4/blur.svg#blur")    
} 

Any help?
Thank you

like image 757
mottalrd Avatar asked Feb 02 '26 08:02

mottalrd


2 Answers

I used this POST for creating blur effect but I added coding base64.

img.blur { 
    filter: blur(3px);
    -webkit-filter: blur(3px);
    -moz-filter: blur(3px);
    -o-filter: blur(3px);
    -ms-filter: blur(3px);
    filter: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQoJPGZpbHRlciBpZD0iYmx1ciI+DQoJCTxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjMiIC8+DQoJPC9maWx0ZXI+DQo8L3N2Zz4=#blur);
}

DEMO

Code for SVG file

<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
    <filter id="blur">
        <feGaussianBlur stdDeviation="3" />
    </filter>
</svg>
like image 121
Anon Avatar answered Feb 05 '26 00:02

Anon


Firefox does not support cross origin filters for HTML content. From the relevant blog post:

The SVG elements being used for clipping, masking, and so forth can be loaded from an external document, as long as that document comes from the same origin as the HTML document to which it's applied.

like image 27
Michael Mullany Avatar answered Feb 05 '26 01:02

Michael Mullany



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!