Wordpress 3.2.1特色图像尺寸和裁剪(Wordpress 3.2.1 Featured Image Size and Crop)

我需要帮助找到在帖子中更改特色图像的大小和裁剪的位置和方式。 我查看了functions.php和init.php,但没有成功。 我正在使用inLine主题的子主题。

当前高度设置为130px。

我尝试过改变css,但这只能拉伸图像。

I need help finding where and how to change the size and crop of a featured image within a post. I've looked in functions.php and init.php, but with no success. I'm using a child theme of the inLine theme.

The current height is set for 130px.

I've tried changing the css, but that only stretches the image.

原文:https://stackoverflow.com/questions/7839420

更新时间:2019-11-19 00:39

最满意答案

在您的functions.php中,粘贴其中一个并根据您的喜好调整像素宽度和高度:

set_post_thumbnail_size( 100, 100 ); // 100 pixels wide by 100 pixels tall, box resize mode

要么:

set_post_thumbnail_size( 100, 100, true ); // 100 pixels wide by 100 pixels tall, hard crop mode

In your functions.php, paste one of these and adjust pixel width and height to your liking:

set_post_thumbnail_size( 100, 100 ); // 100 pixels wide by 100 pixels tall, box resize mode

OR:

set_post_thumbnail_size( 100, 100, true ); // 100 pixels wide by 100 pixels tall, hard crop mode

相关问答

Add the following code into your function.php hope the solution of answer

the_post_thumbnail('large'); // Large resolution (default 640px x 640px max)

Add the following code into your function.php hope the solution of answer

the_post_thumbnail('l

...

在您的functions.php中,粘贴其中一个并根据您的喜好调整像素宽度和高度: set_post_thumbnail_size( 100, 100 ); // 100 pixels wide by 100 pixels tall, box resize mode

要么: set_post_thumbnail_size( 100, 100, true ); // 100 pixels wide by 100 pixels tall, hard crop mode

In your functi

...

缩略图仅生成一次(上传时)。 因此,添加新的add_image_size()调用不会影响任何已上传的图像。 您需要重新生成缩略图,例如使用Regenerate Thumbnails插件 。 Actually installing "php-gd2" on my server resolved the issue. Initially it was running "php-gd" library. Thanks everyone

你应该去wp-admin->includes->post.php和第1295行(取决于版本)你会发现: if ( !empty( $thumbnail_html ) ) {

$ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );

$content = sprintf( $set_thumbnail_link, $upload_iframe_src, $thumbnail_html );

$con

...

是的,你可以这样做,只需转到functions.php并定义所需的大小,例如如下: - add_image_size( 'first', 80, 80, true );

add_image_size( 'second', 120, 120, true );

add_image_size( 'third', 180, 180, true );

之后,您可以在要显示特定图像大小的位置定义所需大小,如下所示: - the_post_thumbnail('first');

the_post_thumbn

...

也许这是你想要的,注意应用的CSS。 还有: // Generate Random Color

function getRandomColor() {

var letters = '0123456789ABCDEF'.split('');

var color = '#';

for (var i = 0; i < 6; i++ ) {

color += letters[Math.floor(Math.random() * 16)];

}

ret

...

Scissors不适合你,因为你使用的是Wordpress 2.9吗? 似乎有人为Wordpress 2.9创建了Scissors的修改版本 。 最大图像大小控制似乎也提供此功能。 不过,我自己没有使用过这些插件。 祝你好运! Does Scissors not work for you because you are using Wordpress 2.9? It appears someone has created a modified version of Scissors for Wor

...

不确定如何禁用裁剪,但您可以尝试使用add_image_size函数来注册更大的图像大小。 像这样:(在functions.php中添加) add_image_size( 'featuredImageCropped', 1024, 768, true );

然后在模板中找到the_post_thumbnail并将其修改为: the_post_thumbnail( 'featuredImageCropped' );

Not sure how to disable cropping but yo

...

add_image_size('small-thumbnail', 180, 120, true);

更改180和120值(宽度和高度),你应该很好。 此资源也可能对您有所帮助: https://wordpress.org/support/topic/set-featured-image-size 您还可以使用名为Simple Image Sizes的插件来控制这些值 I fixed my own problem. In the index.php I was using small_thumb

...

图像缩小,因为当图像实际为1903px时,最大宽度设置为“1900px”。 The image is scaling down because there's a max-width set of "1900px" when the image is actually 1903px.

特色图像尺寸css,Wordpress 3.2.1特色图像尺寸和裁剪(Wordpress 3.2.1 Featured Image Size and Crop)...相关推荐

  1. css如何翻转背景图像,使用CSS反转父元素的背景图像

    我在这里遇到了一个难题(我认为).假设以下HTML:使用CSS反转父元素的背景图像 与它定义了以下CSS: #page { background: url("some-image.png&q ...

  2. css完整总结:第二篇(尺寸,外补白,内补白,边框,背景,颜色,字体,文本,文本装饰)

    这次对CSS中所有的语法进行一次综合性的总结,后续的文章,将侧重与JavaScript和PHP,微信开发(小程序),以及Linux运维方面.css中设计到定位,布局,尺寸,外补白,内补白,边框,背景, ...

  3. css 缩放_【开发小技巧】06—如何使用CSS在鼠标悬停时缩放图像?

    英文 | https://www.geeksforgeeks.org/how-to-zoom-an-image-on-mouse-hover-using-css/?ref=rp翻译 | web前端开发 ...

  4. css 实现16:9比例自适应手机尺寸,可设置任意比例

    css 实现16:9比例自适应手机尺寸,可设置任意比例 .wrap {position: relative;width: 100%;height: 0;/* 比例:就是设置paddig-bottom ...

  5. CSS控制背景颜色和背景图像的方法

    Web前端培训中比较重要的一环是网页的设计,网页能通过背景图像给人留下第一印象,如节日题材的网站一般采用喜庆祥和的图片来突出效果,所以在网页设计中,控制背景颜色和背景图像是一个很重要的步骤.下面将详细 ...

  6. css图片精灵定位_DIV CSS Sprites精灵 CSS图像拼合 CSS背景贴图定位教程案例

    div css sprites精灵-CSS图像拼合 CSS贴图定位网页背景素材图片拼合定位布局技术教程篇与css sprites实例篇 css sprites拼合背景图片素材实现布局效果截图 一.什么 ...

  7. 一个初级前端结合css、div谈一谈屏幕尺寸、分辨率、缩放概念题

    写在前面: 本文作为本人学习总结之用,同时分享给大家~ 个人前端博客网站:https://zhangqiang.hk.cn 欢迎加入博主的前端学习qq交流群::706947563,专注前端开发,共同学 ...

  8. div css sprites精灵-CSS图像拼合 CSS贴图定位网页背景素材图片拼合定位布局技术教程

    div css sprites精灵-CSS图像拼合 CSS贴图定位网页背景素材图片拼合定位布局技术教程篇与css sprites实例篇 css sprites拼合背景图片素材实现布局效果截图 一.什么 ...

  9. css语言中选项是背景图像的属性,HTML_学习CSS的背景图像属性background,CSS的背景属性“background”提供 - phpStudy...

    学习CSS的背景图像属性background CSS的背景属性"background"提供了众多属性值,如颜色.图像.定位等,为网页背景图像的定义提供了极大的便利.看看backgr ...

最新文章

  1. mysql行转列和列转行_mysql 行转列和列转行实例详解
  2. 大理大学日常作业计算机基础知识,大理学院成人高等教育计算机应用基础课程作业题及答案...
  3. 案例:6 种 A / B 测试成功培养用户使用习惯
  4. Vue的v-for中列表项拖拽排序详细方法
  5. linux 下mysql安装配置管理以及优化
  6. .NET调用Oracle存储过程,使用数组类型的参数(如ArrayList)
  7. [react] 有使用过Consumer吗
  8. vue项目中iview表单验证 this.$refs[name].validate(valid = { }无效
  9. 未完待续:关于DB Link和SCN,你还需要知道的是...
  10. Android Studio打包Android Library为jar方案
  11. 【MyBatis笔记】06-Mapper动态代理
  12. electron 改变窗体 大小_「Science子刊」约翰·霍普金斯大学创造灰尘大小设备,可协助药物在胃肠道停留24小时之久...
  13. Helm 3 完整教程(十八):Helm 流控制结构(2)with 语句
  14. 2016 ECCV论文 《Peak-Piloted Deep Network for Facial Expression Recognition》
  15. 第31讲 聊天室程序
  16. android 刷机文件怎么打开,安卓手机怎么刷机
  17. Skyline软件二次开发初级——4如何在WEB页面中的三维地图上使用弹出框Popups
  18. 网络定位服务NetworkLocationProvider
  19. mdui前端插件,有菜单对话框等
  20. 同一局域网下windows主机和wsl子系统相互网络服务访问

热门文章

  1. 二目运算符是什么意思?
  2. 如何学习VB最新总结
  3. 简单的职工信息管理系统(运用了存储过程,和datagridview,dataset的设置)
  4. 【云原生系列】第三讲:Knative 之 Serving
  5. 创业项目-网赚项目 - 靠一份文档做到月入数万
  6. 新氧放弃私有化:曾由CEO金星发起 公司市值已不足1亿美元
  7. MAC下linux双系统的安装
  8. [论文阅读笔记44]Named Entity Recognition without Labelled Data:A Weak Supervision Approach
  9. java课程任务_修真院java后端工程师学习课程--任务1(day three)
  10. ibatis新手上路