


Detailed explanation of the solution to the distortion and blurring of DedeCMS thumbnails
This article mainly introduces DreamWeaver DedeCMSThumbnail The perfect solution to distortion and blur , since dede only generates one size thumbnail by default, which cannot meet the needs of most websites, this article gives an ultimate and perfect solution. Friends in need can refer to it
Since dede only generates one thumbnail by default Thumbnails of different sizes are often inconsistent in size and proportion in different pages of a website, which results in unclear and distorted thumbnails. The method provided below perfectly solves this problem.
dedecms template download address: www.php.cn/xiazai/code/dedecms
Instructions for use:
1. To get a clear thumbnail, it must be large enough Picture and crop it accurately, and the following method is to crop it based on the thumbnail (because some websites of the original picture have watermarks), so you must ensure that the original thumbnail is large enough, so you need to set it up: System- Attachment settings, set the default width and height of thumbnails to be greater than or equal to the maximum size of all thumbnails called in your entire site. Please also cut it to a large enough size for manual trimming (no need for manual trimming)
2. Open include/extend.func.php (Note: This file is prepared for secondary development and used for functional method expansion)
Add the following code before the last ?>
The code is as follows:
function thumb($imgurl, $ width , $ height , $bg = true) { global $cfg_ main site,$cfg_multi_site; $thumb = eregi("http://",$imgurl)? str_replace ($cfg_mainsite,'',$imgurl):$imgurl; list ($thumbname,$extname) = explode ('.',$thumb); $ new thumb = $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; }
Calling method:
Tag:
[field:picname function='thumb(@me,$width,$height,$bg)'/]
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-attachment settings (true/false)
Example:
Call a thumbnail with a length and width of 100 pixels:
[field:picname function='thumb(@me,100,100)'/]
Keep the original proportion and do not automatically fill (not recommended):
[field:picname function='thumb(@me,100,100,false)'/]
The above is the detailed content of Detailed explanation of the solution to the distortion and blurring of DedeCMS thumbnails. 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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











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

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].

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.

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

Generally speaking, pictures on the computer will be displayed in the form of thumbnails, which is very convenient to read. However, some friends have recently encountered the problem of win11 pictures not displaying thumbnails. This may be because we have turned on the best performance, and it can be solved by turning it off under advanced system settings. Win11 pictures do not display thumbnails: First, right-click "This PC" and open "Properties". Second, click on "Advanced System Settings" in the relevant link. Third, click the "Settings" button under Performance. The fourth step is to check "Best Settings" or "Best Appearance" and click "OK" to save, which can solve the problem.

How to implement image browsing and thumbnail navigation through Vue? With the development of web applications, pictures play an increasingly important role in our daily lives. In many cases, we need to implement image browsing and thumbnail navigation functions. This article will introduce how to use the Vue framework to implement this function and provide code examples. In Vue, we can use the Vue plug-in to implement image browsing and thumbnail navigation functions. A popular plugin is vue-gallery, which provides a simple and easy-to-use interface

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

How to use PHP to implement the automatic thumbnail generation function of the CMS system. With the rapid development of the Internet, the content management system (Content Management System, referred to as CMS) plays an important role in website development. For CMS systems, image processing is a common requirement, and generating thumbnails is one of the common functions. This article will introduce in detail how to use PHP to realize the automatic generation of thumbnails in the CMS system. Before we start, we need to understand some basic
