aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2021-01-07 11:17:25 +0100
committerAndreas Gohr <andi@splitbrain.org>2021-01-07 11:17:25 +0100
commit24115d4272bd0e03b95139e41c743d8cdb058328 (patch)
treed3ea8f61788b0a1737f02306482bc397ce24e1d4
parent9453716dc4e120c7e2ebc01fba4d27c53f881e0c (diff)
downloaddokuwiki-24115d4272bd0e03b95139e41c743d8cdb058328.tar.gz
dokuwiki-24115d4272bd0e03b95139e41c743d8cdb058328.zip
use SVG icons for media file links
The dokuwiki template should probably be adjusted a bit. Old png files are not yet removed as they may be used elsewhere still.
-rw-r--r--lib/exe/css.php20
-rw-r--r--lib/images/fileicons/svg/README1
-rw-r--r--lib/images/fileicons/svg/index.php22
3 files changed, 31 insertions, 12 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php
index 2ea2c0963..9ca1bac48 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -357,30 +357,26 @@ function css_filetypes(){
// default style
echo '.mediafile {';
- echo ' background: transparent url('.DOKU_BASE.'lib/images/fileicons/file.png) 0px 1px no-repeat;';
- echo ' padding-left: 18px;';
- echo ' padding-bottom: 1px;';
+ echo ' background: transparent url('.DOKU_BASE.'lib/images/fileicons/svg/file.svg) 0px 1px no-repeat;';
+ echo ' background-size: 1.2em;';
+ echo ' padding-left: 1.5em;';
echo '}';
// additional styles when icon available
// scan directory for all icons
$exts = array();
- if($dh = opendir(DOKU_INC.'lib/images/fileicons')){
+ if($dh = opendir(DOKU_INC.'lib/images/fileicons/svg')){
while(false !== ($file = readdir($dh))){
- if(preg_match('/([_\-a-z0-9]+(?:\.[_\-a-z0-9]+)*?)\.(png|gif)/i',$file,$match)){
- $ext = strtolower($match[1]);
- $type = '.'.strtolower($match[2]);
- if($ext!='file' && (!isset($exts[$ext]) || $type=='.png')){
- $exts[$ext] = $type;
- }
+ if(preg_match('/(.*?)\.svg$/i',$file, $match)){
+ $exts[] = strtolower($match[1]);
}
}
closedir($dh);
}
- foreach($exts as $ext=>$type){
+ foreach($exts as $ext){
$class = preg_replace('/[^_\-a-z0-9]+/','_',$ext);
echo ".mf_$class {";
- echo ' background-image: url('.DOKU_BASE.'lib/images/fileicons/'.$ext.$type.')';
+ echo ' background-image: url('.DOKU_BASE.'lib/images/fileicons/svg/'.$ext.'.svg)';
echo '}';
}
}
diff --git a/lib/images/fileicons/svg/README b/lib/images/fileicons/svg/README
new file mode 100644
index 000000000..4e7770bed
--- /dev/null
+++ b/lib/images/fileicons/svg/README
@@ -0,0 +1 @@
+Icons come from https://fileicons.org/
diff --git a/lib/images/fileicons/svg/index.php b/lib/images/fileicons/svg/index.php
new file mode 100644
index 000000000..66c4835af
--- /dev/null
+++ b/lib/images/fileicons/svg/index.php
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+ <title>Filetype icons</title>
+
+ <style>
+ body {
+ background-color: #fff;
+ font-family: Arial;
+ }
+ </style>
+
+</head>
+
+<body>
+<?php
+foreach (glob('*.svg') as $img) {
+ echo '<img src="'.$img.'" alt="'.$img.'" width="32" height="32" title="'.$img.'" /> ';
+}
+?>
+</body>
+</html>