在 wordpress 中将图像裁剪为特定大小 [英] crop image to a certain size in wordpress
本文介绍了在 wordpress 中将图像裁剪为特定大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将图像裁剪为某个图像.
I am trying to crop a image to a certain.
我试过使用
add_image_size( 'other', 105, 70, true );
$imageString.= '<div><a href="' . $linkstring . '">' . get_the_post_thumbnail($post->ID, 'other;) . '</a></div>';
但它似乎没有裁剪到那个确切的尺寸.
But it does not seem to crop to that exact dimension.
有什么想法吗?
推荐答案
通常您将图像大小添加到您的 functions.php 文件中.
Generally you add image sizes into your functions.php file.
//post thumbnail support
add_action( 'after_setup_theme', 'theme_setup' );
function theme_setup() {
if ( function_exists( 'add_theme_support' ) ) {
add_image_size( 'other', 105, 70, true );
}
}
然后,一旦到位,对于所有新的图像上传,wordpress 都会创建一个该大小的图像.
Then, once in place, for all new image uploads wordpress will create an image at that size.
如果您想为已经上传的图像创建这些图像大小,请查看 http://wordpress.org/extend/plugins/regenerate-thumbnails/
If you want to create these image sizes for already uploaded images, have a look at http://wordpress.org/extend/plugins/regenerate-thumbnails/
这篇关于在 wordpress 中将图像裁剪为特定大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文