Adminesw_display_svg_media()

esw_display_svg_media()

Gives SVGs real dimensions in the media library's JavaScript data.

Function · Easy SVG · Status: Internal · Defined in easy-svg.php

Internal: not part of the promised public surface. It may change without notice.

Usage

esw_display_svg_media( array $response, WP_Post $attachment, array $meta ): array

Example

remove_filter( 'wp_prepare_attachment_for_js', 'esw_display_svg_media', 10 );

Description

Hooked on wp_prepare_attachment_for_js regardless of the upload switch. For image/svg+xml it fills image, thumb and sizes.full with the file URL and the dimensions from easy_svg_read_svg_dimensions(); an unreadable file leaves the response as it is. Pluggable.

Parameters

body
$responsearray

Attachment data for JS.

body
$attachmentWP_Post

The attachment.

body
$metaarray

Attachment metadata.

Return value

returnarray

The response.