summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2020-04-15 12:15:18 +0800
committerBigCoke233 <hi@guhub.cn>2020-04-15 12:15:18 +0800
commit7866c9f6a2353fd93a279b5a22872c52bb81b08b (patch)
tree8ebfac54ff49ab61ec79f3ea551ef457f1bc21d6
parentae0351105cebf8a3787d8ebb454a25f80dbe0e6d (diff)
:dizzy: Add: 支持解析图题
-rw-r--r--assets/css/main/post.css4
-rw-r--r--libs/Contents.php4
2 files changed, 6 insertions, 2 deletions
diff --git a/assets/css/main/post.css b/assets/css/main/post.css
index 9e5c2fe..6aaeff2 100644
--- a/assets/css/main/post.css
+++ b/assets/css/main/post.css
@@ -388,6 +388,10 @@
.post-img-shadow img {
box-shadow: 0 8px 15px rgba(0,0,0,0.45);
}
+.post-img-alt {
+ font-size: 0.9em;
+ color: gray
+}
/* >文章分页 */
.post-pagenav,
diff --git a/libs/Contents.php b/libs/Contents.php
index e65d81b..75aa833 100644
--- a/libs/Contents.php
+++ b/libs/Contents.php
@@ -29,8 +29,8 @@ class Contents
* 解析图片
*/
static public function parseImages($text){
- //FancyBox
- $text = preg_replace('/<img(.*?)src="(.*?)"(.*?)alt="(.*?)"(.*?)>/s','<center><a data-fancybox="gallery" href="${2}" class="gallery-link"><img${1}src="${2}"${3}></a></center>',$text);
+ //FancyBox & 图题
+ $text = preg_replace('/<img(.*?)src="(.*?)"(.*?)alt="(.*?)"(.*?)>/s','<center><a data-fancybox="gallery" href="${2}" class="gallery-link"><img${1}src="${2}"${3}></a><span class="post-img-alt">${4}</span></center>',$text);
return $text;
}