用户工具

站点工具


wiki:wiki语法测试:图片测试

这是本文档旧的修订版!


图片测试

====== ctrl-v图像粘贴插件 ======

这个是图片插件,ImgPaste,在编辑窗口直接用Ctrl-V,会完成自动上传加链接,预览即可看到图片粘贴效果。 https://www.dokuwiki.org/plugin:imgpaste

====== resize ====== <code> Real size: {{wiki:dokuwiki-128.png}} Resize to given width: {{wiki:dokuwiki-128.png?50}} Resize to given width and height: {{wiki:dokuwiki-128.png?200×50}} Resized external image: {{http://php.net/images/php.gif?200x50}} </code>

====== link ======

<code> {{wiki:dokuwiki-128.png}} -- 显示图像,点击后图像后,显示原图和metadata信息。 {{wiki:dokuwiki-128.png?direct}} -- 显示图像,点击图像后显示原图 {{wiki:dokuwiki-128.png?nolink}} -- 显示图像,图像本身无链接,点击无效。 {{wiki:dokuwiki-128.png?linkonly}} -- 只是显示图像文件名,不显示图像,点击链接打开图像。 {{wiki:dokuwiki-128.png?nolink&100}} -- 显示图像,图像无link, 图像resize到宽度100 </code>

====== 无用png文件搜索 ====== 执行下面这个perl脚本,为显示出未使用的png文件,然后可以手动将其删除。

<code perl> #!/usr/bin/perl use File::Basename;

$wiki_path = “/var/www/html/dokuwiki”;

$findret = find $wiki_path/data/media -name *.png; @ar = split(/\n/, $findret);

foreach $line (@ar) {

$name = &basename($line);
$ret = `grep $name $wiki_path/data/pages/* -r`;
if ($ret eq "") {
    print "rm -rf $line\n";
}

} </code>

python3代码,可直接在qnap上运行。
<code python> [~] # cat ./del_unused_png_in_wiki.py #!/usr/bin/env python3

-*- coding: UTF-8 -*-

import re import sys import os import os.path

file_list = []

def search(path):

for entry in os.scandir(path):
    if entry.is_file():
        file_list.append(entry.path)
        #print(entry.path)
    else:
        search(path+'/'+str(entry.name))

if name=='main':

#path = sys.argv[1]
path = "/share/Web/wiki/data/media"
search(path)
for tmp in file_list:
    if (re.search(r'pasted', tmp) == None):
       continue
    if (re.search(r'png', tmp) == None):
       continue
    name = os.path.basename(tmp)
    #print(f'tmp = {tmp}, name = {name}')
    ret = os.system(f'grep {name} /share/Web/wiki/data/pages/* -r -q')
    #print(f'ret = {ret}')
    if (ret != 0):
       print(f'rm -rf {tmp}')

[~] # [~] # source /etc/profile.d/python3.bash
[~] # python3 ./del_unused_png_in_wiki.py [~] # [~] # </code>

{{语法测试:pasted:20191030-123319.png}}

<WRAP group> <WRAP half column> 图片2,-- \ {{语法测试:pasted:20191030-124703.png}} </WRAP>

<WRAP half column> 需要有上传权限才可以传图片\ {{语法测试:pasted:20191030-125550.png}} </WRAP> </WRAP>

{{tag>图片测试tag}}

{{tag>图片tag0}}

wiki/wiki语法测试/图片测试.1679645223.txt.gz · 最后更改: (外部编辑)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki