douya2007 2013-12-22 02:38
浏览 98
已采纳

如何在WordPress中调整缩放图像并将缩放图像裁剪为特定的高度和宽度? [关闭]

Presently I am doing a project in WordPress. It's a daily news update site. My layout goes like this:

enter image description here

In the above Layout I set the images of posts by Featured Post Images and displayed by using the get_the_post_thumbnail(postid). While using this function my image getting stretched and distorted.

And I tried another way by passing size attribute to above function like medium and large, but no luck.

My question can we get two predefined like (830px/542px and 800px/330px) sizes of images at a time while uploading any size of image to a WordPress.

I tried some plugins that are available in WordPress, but there is no luck in that either.

  • 写回答

3条回答 默认 最新

  • dongzhenqi2015 2013-12-22 03:01
    关注

    You could use add_image_size(). Throw a couple of those in your theme functions.php file or a plugin you are creating for this. This will create an appropriately sized image for every image you upload in the admin. It will not, however, upscale an image. Thus this will only create an image of 830px/542px and 800px/330px if the source image is larger than that. This should be fine though.

    Hope that helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 vs2022无法联网
  • ¥15 TCP的客户端和服务器的互联
  • ¥15 VB.NET操作免驱摄像头
  • ¥15 笔记本上移动热点开关状态查询
  • ¥85 类鸟群Boids——仿真鸟群避障的相关问题
  • ¥15 CFEDEM自带算例错误,如何解决?
  • ¥15 有没有会使用flac3d软件的家人
  • ¥20 360摄像头无法解绑使用,请教解绑当前账号绑定问题,
  • ¥15 docker实践项目
  • ¥15 利用pthon计算薄膜结构的光导纳