Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

缩略图生成的图片变形了。 #74

Open
mrjucn opened this issue Dec 23, 2022 · 4 comments
Open

缩略图生成的图片变形了。 #74

mrjucn opened this issue Dec 23, 2022 · 4 comments
Assignees

Comments

@mrjucn
Copy link

mrjucn commented Dec 23, 2022

貌似只有当图片是正方形的时候才会不变形。这样的话,长方形图片生成的缩略图就很难看了。
可以修改成居中裁剪吗,多余的裁剪掉无所谓。变形看起来是真的难受额。

我看源码解决了。打扰大佬啦。zc = 1 就好了。默认的不裁剪只缩放。值为 0.

@icret icret self-assigned this Feb 4, 2023
@vvnocode
Copy link

哪里的zc?

@ChiehJang
Copy link

ChiehJang commented Jun 2, 2023

附议,希望大佬调整不等宽图片的缩略图显示效果💡

@Variante
Copy link

哪里的zc?

看起来正确的做法是创建一个timthumb-config.php文件然后更改DEFAULT_ZC

if (!defined('DEFAULT_ZC'))
define('DEFAULT_ZC', 1); // Default zoom/crop setting. Allows overrid in timthumb-config.php

不过也可以直接把这一行改成1就是了(x

$zoom_crop = (int)$this->param('zc', DEFAULT_ZC);

@Sab1e-GitHub
Copy link

设置-图床安全-缩略图生成方式
image

缩略图生成方式为“TimThumb”时可以使用
#74 (comment)

如果缩略图生成方式是“原图”,可以直接在list.php里面给img加个object-fit: cover属性就行了。

<li><img src="<?php static_cdn(); ?>/public/images/loading.svg" data-image="<?php echo creat_thumbnail_by_list($imgUrl); ?>" data-original="<?php echo $imgUrl; ?>" alt="简单图床-EasyImage"></li>

修改后的代码:
<li><img src="<?php static_cdn(); ?>/public/images/loading.svg" data-image="<?php echo creat_thumbnail_by_list($imgUrl); ?>" data-original="<?php echo $imgUrl; ?>" style="object-fit: cover;" alt="简单图床-EasyImage"></li>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants