WordPress裁剪缩略图未显示

发布于 2025-02-09 07:11:26 字数 331 浏览 3 评论 0原文

我正在尝试在WordPress中显示自定义的裁剪缩略图。

这是我的代码:

add_image_size('about-us-slider-image', 610, 820, true);

在正面:

echo wp_get_attachment_image_url($imgID, 'about-us-slider-image');

但仅显示原始大小。原始图像大于该尺寸,我还尝试了再生缩略图。

怪异的部分是,在服务器上,所有裁剪大小都是可见的,但在var_dump()或其他任何地方都不可见。

I'm trying to display custom cropped thumbnails in Wordpress.

Here is my code:

add_image_size('about-us-slider-image', 610, 820, true);

And in the front:

echo wp_get_attachment_image_url($imgID, 'about-us-slider-image');

But only original size is shown. Original image is larger than this dimensions and I also tried regenerating thumbnails.

The weird part is that on the server all cropped sizes are visible but not in var_dump() or anywhere else.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橘寄 2025-02-16 07:11:26

在function.php中添加此代码后,您必须再生缩略图,然后将其显示为您的尺寸。您必须使用此插件再生。

https://wordpress.org/plugins/regenerate-regenerate-thumbnails-thumbnails-Advanced/

You have to regenerate the thumbnail after you added this code in function.php then after that it will appear like what you put the size. You have to regenerate by using this plugin.

https://wordpress.org/plugins/regenerate-thumbnails-advanced/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文