DedeCMS 5.1 版缩略图怎么修改?
以前曾收录过这篇文章[Dedecms生成漂亮整齐的缩略图],我做了下尝试,生成缩略图的时候还是会有问题。今天看到这个文章,做个补充。
推荐学习:织梦cms
勾选 “提取第一张图片为缩略图” 实际是将第一张图当作缩略图 并没有生成带"_lit"的小图
修改文件:\dede\action\article_add_action.php
先看原代码
代码如下:
//自动获取缩略图 if($autolitpic==1 && $litpic==''){ $litpic = GetDDImgFromBody($body); }
大概意思应该就是“缩略图=获取图像从主题内容”
也就是上面说的实际是第一张原图 这就是问题所在
参考了4.X里提取缩略图代码,更改为:
代码如下:
//自动获取缩略图-改 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); } }
同理\dede\action\article_eidt_action.php更改为:
代码如下:
//自动获取缩略图-改 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); } }
然后将这两个文件 复制覆盖到\dede\下。
OK!这样就能打到勾选“提取第一张...”生成缩略图的目的了。
缩略图变形 参考[Dedecms生成漂亮整齐的缩略图]
需修改文件:\include\inc_photograph.php
找到:($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); 共三处。
改为:($ni,$im,0,0,$src_X,$src_Y,$ftoW,$ftoH,$srcW,$srcH);
修改了缩图函数,就能在原图中截取居中的、最大面积的符合自定义缩略图长宽比列的一部分生成缩略图。
The above is the detailed content of How to modify thumbnails in DedeCMS version 5.1. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver Mac version
Visual web development tools
