Changeset 2731665
- Timestamp:
- 05/26/2022 10:12:08 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asf-allow-svg-files/trunk/asfwp-allow-svg-files.php
r2672768 r2731665 83 83 84 84 85 function asfwp_cc_mime_types($mimes) { 86 define('ALLOW_UNFILTERED_UPLOADS', true); 85 // function asfwp_cc_mime_types($mimes) { 86 // define('ALLOW_UNFILTERED_UPLOADS', true); 87 // $mimes['svg'] = 'image/svg+xml'; 88 // $mimes['svgz'] = 'image/svg+xml'; 89 // return $mimes; 90 // } 91 // add_filter('upload_mimes', 'asfwp_cc_mime_types'); 92 93 // Allow SVG 94 add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) { 95 96 global $wp_version; 97 if ( $wp_version !== '5.9' ) { 98 return $data; 99 } 100 101 $filetype = wp_check_filetype( $filename, $mimes ); 102 103 return [ 104 'ext' => $filetype['ext'], 105 'type' => $filetype['type'], 106 'proper_filename' => $data['proper_filename'] 107 ]; 108 109 }, 10, 4 ); 110 111 function asfwp_cc_mime_types( $mimes ){ 87 112 $mimes['svg'] = 'image/svg+xml'; 88 $mimes['svgz'] = 'image/svg+xml';89 113 return $mimes; 90 114 } 91 add_filter('upload_mimes', 'asfwp_cc_mime_types'); 115 add_filter( 'upload_mimes', 'asfwp_cc_mime_types' ); 116 117 function asfwp_fix_svg() { 118 echo '<style type="text/css"> 119 .attachment-266x266, .thumbnail img { 120 width: 100% !important; 121 height: auto !important; 122 } 123 </style>'; 124 } 125 add_action( 'admin_head', 'asfwp_fix_svg' );
Note: See TracChangeset
for help on using the changeset viewer.