每次发表带图片的文章,当图片太大时,有时会占了大半个屏幕,对阅读体验非常不好,因为有图片灯箱弹窗,想看图片直接点击图片就行了,所以就不需要默认显示完整图片的大小。

HyperDown.php

打开根目录下的/var/HyperDown.php

搜索

1
"<img src=\"{$url}\" alt=\"{$escaped}\" title=\"{$escaped}\">"

替换为:

1
"<img src=\"{$url}\" alt=\"{$escaped}\" title=\"{$escaped}\" style=\"max-width:300px;max-height:400px\" >"

再次搜索

1
"<img src=\"{$self->_definitions[$matches[2]]}\" alt=\"{$escaped}\" title=\"{$escaped}\">"

替换为:

1
 "<img src=\"{$self->_definitions[$matches[2]]}\" alt=\"{$escaped}\" title=\"{$escaped}\" style=\"max-width:300px;max-height:400px\" >"

上面的代码,设置的是限制图片最大高度为 400px,最大宽度为 300px。 保存覆盖这个文件即可。