Home CMS Tutorial DEDECMS What should I do if the thumbnail is distorted when calling DreamWeaver CMS?

What should I do if the thumbnail is distorted when calling DreamWeaver CMS?

Feb 22, 2023 pm 05:01 PM
thumbnail dreamweavercms

Solution to the distortion of thumbnails called by DreamWeaver cms: 1. In "System-Attachment Settings", set the default width and height of the thumbnails to be greater than or equal to the maximum size of all called thumbnails in the entire site; 2. Open the "/include/extend.func.php" file and add the code as "function thumb($imgurl, $width, $height, $bg = true){...}".

What should I do if the thumbnail is distorted when calling DreamWeaver CMS?

The operating environment of this tutorial: Windows 10 system, DedeCMS version 5.7, Dell G3 computer.

What should I do if the thumbnail is distorted when calling DreamWeaver cms?

Solution to dede thumbnail distortion and blurring

Since dedecms only generates one size thumbnail by default, the thumbnails required in different pages of a website are often The thumbnails are inconsistent in size and proportion, which results in unclear and distorted thumbnails, which cannot meet the needs of most websites. This article gives an ultimate solution

Modification method:

1. To obtain clear thumbnails, you need to have a large enough image and crop it accurately. The following method is to crop based on the thumbnail (because some websites in the original image have watermarks), so you must Make sure that the original thumbnail is large enough, so you need to make some settings: System - Attachment Settings, set the default width and default height of the thumbnail to be greater than or equal to the maximum size of all the thumbnails called in your entire site. Please also cut it to be large enough for manual cutting. (No need to cut it by hand)

2. Open the /include/extend.func.php file (Note: This file is prepared for secondary development and used for functional method expansion)

Add the following code before the last ?>:

function thumb($imgurl, $width, $height, $bg = true)
{
global $cfg_mainsite,$cfg_multi_site;
$thumb = eregi("http://",$imgurl)?str_replace($cfg_mainsite,'',$imgurl):$imgurl;
list($thumbname,$extname) = explode('.',$thumb);
$newthumb = $thumbname.'_'.$width.'_'.$height.'.'.$extname;
if(!$thumbname || !$extname || !file_exists(DEDEROOT.$thumb)) return $imgurl;
if(!file_exists(DEDEROOT.$newthumb))
{
include_once DEDEINC.'/image.func.php';
if($bg==true)
{
ImageResizeNew(DEDEROOT.$thumb, $width, $height, DEDEROOT.$newthumb);
}
else
{
ImageResize(DEDEROOT.$thumb, $width, $height, DEDEROOT.$newthumb);
}
}
return $cfg_multi_site=='Y'?$cfg_mainsite.$newthumb:$newthumb;
}
Copy after login

Calling method:

[field:picname function='thumb(@me,$width,$height,$bg)'/]
Copy after login

Parameter description:

$width: thumbnail width (integer)

$height: Thumbnail height (integer)

$bg: Whether to fill with blanks, automatically filled by default, background fill color is in the system-accessory settings (true/false)

Example:

Call a thumbnail with a length and width of 100 pixels: [field:picname function='thumb(@me,100,100)'/]

Retain the original proportion , no automatic filling (not recommended): [field:picname function='thumb(@me,100,100,false)'/]

Recommended learning: dedecms tutorial

The above is the detailed content of What should I do if the thumbnail is distorted when calling DreamWeaver CMS?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to disable taskbar thumbnail preview in Win11? Turn off the taskbar icon display thumbnail technique by moving the mouse How to disable taskbar thumbnail preview in Win11? Turn off the taskbar icon display thumbnail technique by moving the mouse Feb 29, 2024 pm 03:20 PM

This article will introduce how to turn off the thumbnail function displayed when the mouse moves the taskbar icon in Win11 system. This feature is turned on by default and displays a thumbnail of the application's current window when the user hovers the mouse pointer over an application icon on the taskbar. However, some users may find this feature less useful or disruptive to their experience and want to turn it off. Taskbar thumbnails can be fun, but they can also be distracting or annoying. Considering how often you hover over this area, you may have inadvertently closed important windows a few times. Another drawback is that it uses more system resources, so if you've been looking for a way to be more resource efficient, we'll show you how to disable it. but

How to display thumbnails in Vscode_How to display thumbnails in Vscode How to display thumbnails in Vscode_How to display thumbnails in Vscode Apr 02, 2024 pm 02:43 PM

1. First enter Visual Studio Code and click [File] in the upper left corner. 2. Then click [Preferences]. 3. Click the [Settings] item. 4. Then click [Text Editor-Thumbnail]. 5. Finally, in the thumbnail item, turn on [Control whether to display thumbnails].

Dreamweaver CMS station group practice sharing Dreamweaver CMS station group practice sharing Mar 18, 2024 am 10:18 AM

Dream Weaver CMS Station Group Practice Sharing In recent years, with the rapid development of the Internet, website construction has become more and more important. When building multiple websites, site group technology has become a very effective method. Among the many website construction tools, Dreamweaver CMS has become the first choice of many website enthusiasts due to its flexibility and ease of use. This article will share some practical experience about Dreamweaver CMS station group, as well as some specific code examples, hoping to provide some help to readers who are exploring station group technology. 1. What is Dreamweaver CMS station group? Dream Weaver CMS

How to display thumbnails on USB drive How to display thumbnails on USB drive Feb 12, 2024 pm 08:36 PM

I often encounter customers who say that a few minor computer problems are very troublesome at critical times. In summary, there are the following. The reason why the file cannot be copied to the USB flash drive may be that the partition format of the USB flash drive is FAT32 instead of NTFS. You can try changing the partition format of the USB flash drive to NTFS so that you can copy large files. Second, the pictures are not displayed as thumbnails, so you have to click on them one by one to find them. The third type is that the page suddenly becomes larger or smaller. If you don’t know these three situations, they can be solved with a few simple operations. 1. Change the U disk partition to NTFS. The default partition format of a newly purchased U disk is generally FAT32. Under normal circumstances, there is no problem in using it. However, when you need to copy files larger than 4G, a prompt that cannot be copied will appear, which brings some trouble to use. for

Detailed explanation of the steps to generate thumbnails in PHP Detailed explanation of the steps to generate thumbnails in PHP Sep 13, 2023 am 08:40 AM

Detailed explanation of the steps to generate thumbnails with PHP, specific code examples are required. In today's era of rapid Internet development, pictures are an indispensable part of web pages, but high-resolution pictures will not only take up a lot of bandwidth, but also affect the user's web page loading. speed. Therefore, we often need to generate thumbnails from original images to reduce image size and file size. As a popular server-side scripting language, PHP provides rich image processing functions that can be used to generate thumbnails. The following will introduce in detail the steps to generate thumbnails in PHP.

How to implement image scrolling and thumbnail preview in Vue? How to implement image scrolling and thumbnail preview in Vue? Aug 18, 2023 pm 01:51 PM

How to implement image scrolling and thumbnail preview in Vue? In Vue projects, we often need to display a large number of pictures, and hope that users can browse and preview these pictures easily. This article will introduce how to use Vue components to implement image scrolling and thumbnail preview functions. First, we need to install and introduce the appropriate Vue library to facilitate image scrolling and thumbnail preview. In this example, we will use vue-awesome-swiper and vue-image-preview two libraries to implement

Is there any fee for DreamWeaver CMS system? Is there any fee for DreamWeaver CMS system? Aug 11, 2023 pm 01:57 PM

There is no charge for the Dreamweaver CMS system. Dreamweaver CMS is an open source content management system. Its core code is provided for free. Users can download the latest version of Dreamweaver CMS for free and obtain relevant technical support and documentation. However, during use, users may need to purchase additional functional modules or theme templates, which are chargeable. The price for purchasing these paid modules and templates depends on the specific functions and design complexity.

Analysis of the reasons why the secondary directory of DreamWeaver CMS cannot be opened Analysis of the reasons why the secondary directory of DreamWeaver CMS cannot be opened Mar 13, 2024 pm 06:24 PM

Title: Analysis of the reasons and solutions for why the secondary directory of DreamWeaver CMS cannot be opened. Dreamweaver CMS (DedeCMS) is a powerful open source content management system that is widely used in the construction of various websites. However, sometimes during the process of building a website, you may encounter a situation where the secondary directory cannot be opened, which brings trouble to the normal operation of the website. In this article, we will analyze the possible reasons why the secondary directory cannot be opened and provide specific code examples to solve this problem. 1. Possible cause analysis: Pseudo-static rule configuration problem: during use

See all articles