wordpress上传图片不自动生成缩略图的解决方法

所属分类: CMS教程 / WordPress 阅读数: 2128
收藏 0 赞 0 分享

因为站点不需要显示这么多图片,只需要原图就OK了,所以就要修改下媒体设置。打开设置->媒体,将不需要的缩略图宽度高度都设置为0就可以了。如下图:



但是这样设置之后,还是会生成其它分辨率的缩略图,笔者猜测应该是主题的问题,于是就去主题内查找,笔者用的主题是themolio。后来在主题文件的functions.php中找到了这样的代码:


复制代码
代码如下:

function themolio_setup() {</p> <p> /* Make Themolio available for translation.
* Translations can be added to the /languages/ directory.
* If you're building a theme based on Themolio, use a find and replace
* to change 'themolio' to the name of your theme in all the template files.
*/
load_theme_textdomain('themolio', get_template_directory().'/languages' );
add_editor_style();
add_theme_support('automatic-feed-links');
add_theme_support('post-thumbnails');</p> <p> /**
* This sets up the image size for the grid based top-down layouts (with no sidebar).
* If you change the width/height of your content,
* you will have to modify the width and height mentioned below as well
*/
add_image_size('themolio-two-col-grid-image-nosidebar',460,300,true);
add_image_size('themolio-three-col-grid-image-nosidebar',290,200,true);
add_image_size('themolio-four-col-grid-image-nosidebar',210,150,true);</p> <p> /**
* This sets up the image size for the grid based top-down layouts (with sidebar).
* If you change the width/height of your content,
* you will have to modify the width and height mentioned below as well
*/
add_image_size('themolio-two-col-grid-image-sidebar',356,250,true);
add_image_size('themolio-three-col-grid-image-sidebar',230,150,true);
add_image_size('themolio-four-col-grid-image-sidebar',171,110,true);</p> <p> /**
* This sets up the image size for the featured image.
* If you change the width/height of your content,
* you will have to modify the width and height mentioned below as well
*/
add_image_size('themolio-featured-image',800,300,true);</p> <p> register_nav_menu('primary', __('Primary Menu', 'themolio'));</p> <p> add_theme_support('post-formats', array('link', 'gallery', 'status', 'quote', 'image', 'video'));</p> <p> if(themolio_is_wp_version('3.4')) {
add_theme_support('custom-background');
} else {
add_custom_background();
}
}

其中add_image_size就是增加缩略图设置的方法,根据需要注释掉即可。其它主题也可以依此类推,只要搜索关键词add_image_size,应当就能找到缩略图的设置。

最后生成多张缩略图的问题就搞定了。

友情提示

如果日后有需要缩略图,可以在媒体->媒体库->选择需要的图片点编辑->编辑图片,然后就可以裁剪图片了。最后报下wordpress和使用主题的版本:

wordpress是3.4.1版本
主题是Themolio,版本是1.2

更多精彩内容其他人还在看

为wordpress绑定多个域名的方法分享

本文主要介绍了WordPress绑定多个域名的方法,wordpress默认情况下会自动跳转到后台规定的home_url上去,如何实现绑定多个域名的功能,详细看下文吧
收藏 0 赞 0 分享

wordpress在postname中支持大写字母的方法

本文主要介绍了wordpress在postname中支持大写字母的方法,wordpress默认会将标题中的英文大写字母lower到小写,要在URL中使用中文,那么使用大写也是常有的,这里提供一种取消wordpress自动降级字母大写的方法
收藏 0 赞 0 分享

wordpress实现用户历史阅读记录功能分享

历史记录是一种较为私密的功能,主要为当前用户提供服务,不同的用户使用不同的终端看到的结果是不同的,不同用户之间不能共享,以保持用户对自己浏览记录的独享性。一般而言,我们有以下几种实现思路
收藏 0 赞 0 分享

wordpress在IIS下伪静态后子目录无法访问的解决方法

wordpress是基于php开发在apache服务下运行是最优秀的由于不小心使用了IIS,因此遇到了关于IIS环境造成的一系列问题,接下来为大家介绍下在IIS下伪静态后子目录无法访问的解决方法
收藏 0 赞 0 分享

用wordpress制作网站的步骤

wordpress建设网站:从买域名空间到安装WP,遇到了一些问题,这里总结几个步骤提供大家参考
收藏 0 赞 0 分享

免插件在wordpress中插入表格的方法

要在 WordPress 中插入表格其实并非难事,只要用 wp-table 插件就能轻松做到,本文的重点是介绍免插件在 WordPress 中插入表格的方法,下面有个不错的示例感兴趣的朋友可以参考下
收藏 0 赞 0 分享

wordpress无法登录后台的解决方案

wordpress3.4.1无法登录后台的解决方法,只需要简单的4个步骤
收藏 0 赞 0 分享

WordPress 防止恶意评论的方法

本文章详细的介绍了关于WordPress 防止恶意评论代码处理办法
收藏 0 赞 0 分享

wordpress制作自定义菜单的方法

本文介绍了wordpress中自定义菜单制作详细教程
收藏 0 赞 0 分享

WordPress增加文章排序方式

很多网站的文章列表页面都可以查看排序方法,但是在wp系统中是没有这个功能,下面我们来看看关于WordPress系统中增加选择文章的排序方式的解决办法
收藏 0 赞 0 分享
查看更多