Ways to handle SVG rendering in wordpress?

Take a look at wp_prepare_attachment_for_js(), which is what gathers attachment metadata for use on the Media pages. The eponymous filter lets us add or alter metadata. The following example can be dropped into functions.php. Note: this requires SimpleXML support in PHP. function common_svg_media_thumbnails($response, $attachment, $meta){ if($response[‘type’] === ‘image’ && $response[‘subtype’] === ‘svg+xml’ && class_exists(‘SimpleXMLElement’)) { … Read more

For what security reasons are svgs blocked in the media uploader?

SVG can contain JavaScript. JavaScript can be used to hijack cookies or do other questionable actions. It can even be “hidden” in namespaces: <html xmlns:ø=”http://www.w3.org/1999/xhtml”> <ø:script src=”https://0x.lv/” /> </html> source It is very hard to filter that out during the upload, so it is just not allowed by default.

SVG files not uploading since most recent WP update

In WordPress 4.7.1 a change was introduced that checks for the real mime type of an uploaded file. This breaks uploading file types like SVG or DOCX. There already exist tickets for this issue in WordPress Core, where you can read more about this: Some Non-image files fail to upload after 4.7.1 (https://core.trac.wordpress.org/ticket/39550) SVG upload … Read more

How to extract svg as file from web page

When the SVG is integrated as <svg …></svg> markup directly into the HTML page. Right click on the SVG to inspect it in developer tools Find the root of the <svg> element and right click to “Copy element” Go to https://jakearchibald.github.io/svgomg/ and “Paste markup” Download your optimized SVG file and enjoy

SVG drop shadow using css3

Here’s an example of applying dropshadow to some svg using the ‘filter’ property. If you want to control the opacity of the dropshadow have a look at this example. The slope attribute controls how much opacity to give to the dropshadow. Relevant bits from the example: Box-shadow is defined to work on CSS boxes (read: … Read more

SVG transparent background web

transparent is not part of the SVG specification, although many UAs such as Firefox do support it anyway. The SVG way would be to set the stroke to none, or alternatively set the stroke-opacity to 0. You also don’t set any value for fill on the <rect> element and the default is black. For a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)