This commit is contained in:
Gitea
2022-03-30 09:13:50 +08:00
parent 15dfc6576b
commit 557aa3c555
179 changed files with 6115 additions and 4092 deletions

View File

@@ -188,6 +188,11 @@ class SingleController extends Controller
$description = escape_string(clear_html_blank(substr_both(strip_tags($_POST['content']), 0, 150)));
}
// 无缩略图时,自动提取文章第一张图为缩略图
if (! $ico && preg_match('/<img\s+.*?src=\s?[\'|\"](.*?(\.gif|\.jpg|\.png|\.jpeg))[\'|\"].*?[\/]?>/i', decode_string($content), $srcs) && isset($srcs[1])) {
$ico = $srcs[1];
}
// 缩放缩略图
if ($ico) {
resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));