Wordpress缩略图大小(Wordpress thumbnail sizes)

编程入门 行业动态 更新时间:2024-10-26 16:30:20
Wordpress缩略图大小(Wordpress thumbnail sizes)

在我的functions.php中,我定义了2个我希望在我的网站上使用的维度,小和自定义大小,我的文件如下所示:

add_theme_support('post-thumbnails'); add_image_size('small', 120, '', true); add_image_size('custom-size', 755, 220, true);

当我检查我的wp-content / uploads文件夹,除了原始图像和120px和755px图像,我看到其他几个尺寸(150px,768px),我想知道为什么显示我是否只有2个维度(我问,因为我是在有限的托管和想要节省磁盘空间,因为我托管了很多图像)。

谢谢!

In my functions.php i defined 2 dimensions i want to use on my site, small and custom-size and my file looks like this:

add_theme_support('post-thumbnails'); add_image_size('small', 120, '', true); add_image_size('custom-size', 755, 220, true);

When i check my wp-content/uploads folder, except original image and 120px and 755px images i see several others dimensions (150px, 768px) and i was wondering why is that showing if i only have 2 dimensions (i am asking because i am on limited hosting and want to save on disk space because i host a lot of images).

Thank you!

最满意答案

这些其他尺寸可能会出现三个原因:

您过去有不同的缩略图尺寸/图像尺寸。 更改图像大小时不会重新创建(或删除)图像,但您可以使用重生缩略图等插件为您执行此操作 - 只需在更改图像大小后单击“工具”菜单下添加的选项。

您安装了一个插件或主题,正在创建其他图像大小。 要跟踪正在执行此操作的内容,您可以在文件中搜索add_image_size ,也可以停用插件/更改主题,然后重新生成缩略图以查看结果。

Wordpress为响应式图像提供了新的隐藏图像大小。 这适用于768px图像的情况。 有关详细信息,请参阅此WP Core博客文章 。 如果您不需要响应式图像,您可以使用该博客文章中的说明(运行例如update_option('medium_large_size_w', '755')或甚至手动更新数据库中的选项来更改应用于此图像的大小 - 它是在wp_options表中)。 再次 - 执行此操作后重新生成缩略图。

There are generally three reasons that these other sizes could be showing up:

You had different thumbnail dimensions / image sizes in the past. Images are not re-created (or deleted) when you change image sizes, but you can use a plugin such as Regenerate Thumbnails to do this for you - just click the options it adds under the Tools menu, after you have changed your image sizes.

You have a plugin or theme installed that is creating additional image sizes. To track down what is doing this, you can either search through the files for add_image_size, or you could deactive plugins/change themes and then regenerate your thumbnails to see what the result is.

Wordpress has a new hidden image size for responsive images. This applies in the case of the 768px image. See this WP Core blog post for details. If you have no need for responsive images you could change the size that applies to this image using the instructions in that blog post (running eg. update_option('medium_large_size_w', '755') or even manually updating the option in the database - it's in the wp_options table). Again - regenerate thumbnails after doing this.

更多推荐

本文发布于:2023-07-27 15:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1292433.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缩略图   大小   Wordpress   thumbnail   sizes

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!