Home > CMS Tutorial > Empire CMS > body text

Solution to the problem of black edges appearing in screenshots shared by Empire cms

silencement
Release: 2019-11-29 14:19:35
forward
1956 people have browsed it

Solution to the problem of black edges appearing in screenshots shared by Empire cms

Empire CMS will only generate thumbnails with black borders on the left and right if the width is greater than the height (horizontal image). We open a picture with black borders and analyze it. Empire CMS scales images according to height. If the width is insufficient, it will be filled with black edges.

Solution: Change scaling based on height to scaling based on width, and then crop the higher part.

Modification method:

1. Open e/class/gd.php

2. Find the code

The code is as follows:

if($big_width >= $max_width and $big_height >= $max_height)
{
if($big_width > $big_height)
{
$tempx = $max_width / $ratioh;
$tempy = $big_height;
$srcX = ($big_width - $tempx) / 2;
$srcY = 0;
}
Copy after login

Modify to

The code is as follows:

if($big_width >= $max_width and $big_height >= $max_height)
{
if($big_width > $big_height)
{
$tempy = $max_height / $ratiow;
$tempx = $big_width;
$srcY = ($big_height - $tempy) / 2;
$srcX = 0;
}
Copy after login

Recommended to study "Empirecms Tutorial"

If you use the thumbnail function, you need to set the interception of the higher part:

sys_ResizeImg (original image, thumbnail width, thumbnail height, whether to crop the image, target file name)
//Whether to crop the image is set to 1

Usually used It is necessary to set: Backend>System>System Settings>System Parameter Settings>Image Settings>Whether to intercept excess parts>Select Yes.

The above is the detailed content of Solution to the problem of black edges appearing in screenshots shared by Empire cms. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:www.word666.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!