Home > Article > CMS Tutorial > 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; }
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; }
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!