How to modify the thumbnail of DedeCMS version 5.1
This article is about how to modify the thumbnails of DedeCMS version 5.1. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
How to modify the thumbnail of DedeCMS version 5.1?
Checking "extract the first picture as a thumbnail" actually treats the first picture as a thumbnail and does not generate a small image with "_ lit"
Modify the file:\ dede\ action\ article_add_action.php
Look at the original code first.
The code is as follows:
/ / automatically get thumbnail if ($autolitpic==1 & & $litpic=='') {$litpic= GetDDImgFromBody ($body);}
Thumbnail = get an image from the subject content
That is, what I said above is actually the first picture, and that's the problem.
Refer to 4.X to extract the thumbnail code and change it to:
The code is as follows:
/ / get thumbnails automatically-change if ($autolitpic==1 & & $litpic=='') {$cfg_medias_dir = str_replace ('/','\ /', $cfg_medias_dir); $picname = preg_replace ("/. +?". $cfg_medias_dir. "(. *) (|\" |). * $/ isU ", $cfg_medias_dir." $1 ", $body) If (eregi ("\. (jpg | gif | png) $", $picname)) {if (ereg ("_ lit\.", $picname)) $litpic = $picname; else $litpic = GetDDImage ('ddfirst',$picname,0);}}
Similarly,\ dede\ action\ article_eidt_action.php is changed to:
The code is as follows:
/ / get thumbnails automatically-change if ($autolitpic==1 & & empty ($litpic)) {$cfg_medias_dir = str_replace ('/','\ /', $cfg_medias_dir); $picname = preg_replace ("/. +?". $cfg_medias_dir. "(. *) (|\" |). $/ isU ", $cfg_medias_dir." $1 ", $body) If (eregi ("\. (jpg | gif | png) $", $picname)) {if (ereg ("_ lit\.", $picname)) $litpic = $picname; else $litpic = GetDDImage ('ddfirst',$picname,0);}}
Then copy and overwrite these two files under\ dede\.
OK! In this way, you can hit the check box "extract the first one." The purpose of generating thumbnails.
Thumbnail deformation reference [Dedecms generates beautiful and neat thumbnails]
The file needs to be modified:\ include\ inc_photograph.php
Find: ($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); three places.
Change to: ($ni,$im,0,0,$src_X,$src_Y,$ftoW,$ftoH,$srcW,$srcH)
By modifying the thumbnail function, the thumbnail can be generated by intercepting the centered, largest part of the thumbnail column that meets the custom thumbnail aspect ratio column in the original image.
Thank you for reading! This is the end of how to modify the thumbnail of DedeCMS 5.1. hope the above content can be helpful to you so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.