【问题标题】:Wordpress not correctly cropping thumbnailsWordpress 无法正确裁剪缩略图
【发布时间】:2013-10-22 00:22:26
【问题描述】:

我在functions.php中启用了缩略图和大小:

add_theme_support( 'post-thumbnails' );
add_image_size( 'post-thumbnail', 150, 150, true );
add_image_size( 'featured-thumbnail', 360, 300, true );

它们在循环中被正确调用,虽然crop 设置为true,但我还没有看到任何图像被裁剪为指定尺寸,它们都“看似”成比例地做到了。每次进行更改时,我都会重新生成缩略图,但没有任何效果。我已经搜索了很多答案,但几乎没有修复(我不想必须使用插件并手动完成)。

有什么想法吗?

【问题讨论】:

    标签: wordpress thumbnails


    【解决方案1】:

    请试试这个:

    if ( function_exists( 'add_image_size' ) ) { 
       add_image_size( 'post-thumbnail', 150, 150, true );// please give another name if its not major requirement of this
       add_image_size( 'featured-thumbnail', 360, 300, true );// please give another name if its not major requirement of this
    }
    

    谢谢。

    【讨论】:

    • 谢谢!我不知道为什么这有什么不同,但它终于奏效了。再次感谢。
    • 此代码在功能上与您的原始代码没有什么不同 - 它一定是您修复它的其他方法(我遇到了同样的问题)
    • 这并不能解决问题。仍在寻找解决方案。
    猜你喜欢
    • 2019-08-13
    • 2015-09-24
    • 1970-01-01
    • 2013-07-28
    • 1970-01-01
    • 2012-05-18
    • 2012-10-25
    • 1970-01-01
    • 2018-04-18
    相关资源
    最近更新 更多