Finally, the multi thumbnail display of Z-Blog article list is completed

skill 4 years ago Lao Li next door Last edited on 2021-02-20 16:05:44

ZBP1.7 has added the thumbnail function. The website has upgraded to use ZBP1.7's own thumbnail generation.

For a long time, the thumbnails of the theme article list used by Lao Li are multiple images extracted from the articles and then output in different forms in the article list.

The image is output without any processing, which causes the page to load very slowly.

like this:

 {php} $pattern = "/<img[^>]*src=\"([^\"]+\.(gif|jpg|png))\"[^>]*>/"; $content = $article->Content; preg_match_all($pattern,$content,$matchContent); {/php} <img src="$matchContent[1][0])" >

 Finally, I got the first multi thumbnail display of Z-Blog article list

However, the thumbnail of the subject article list I published in the application center is to extract the first image of the article, generate a smaller thumbnail, and then output it.

A few days ago, someone asked me why your website didn't generate a thumbnail of the image of the article list. The image is too large, and loading is too slow.

Then, I was speechless and choked... My function of generating thumbnails is copying. The excellent homework copied to me only generates one picture... There are 4 pictures in my website article list... My TMD will not generate 4 thumbnails...

In fact, the above are all excuses, which means I'm too lazy to change...

Then I suddenly became lazy today and solved the problem of generating multiple thumbnails. The turning point is a bit fast...

The list of posts in this blog now shows thumbnails.

Now when you publish an article, the first four pictures in the article will be automatically extracted to generate thumbnails of three sizes, large, medium and small.

In the future, we will change the size and number of pictures into something that can be customized. It is estimated that we will gradually make another plug-in..

Maybe, who knows.


This article is written by@ Lao Li next door Published on May 26, 2020 at Yeluzi Blog , unless otherwise specified, all articles in this blog are original, please retain the source for reprinting.
comment (1)
 visitor
 Zuoyu Xiansen
Can you ask how to realize multi thumbnail display?
· From Guangzhou, Guangdong Province · reply
Top