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 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作