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

所属分类: CMS教程 / WordPress 阅读数: 2133
收藏 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 插件 直接将服务器文件导入媒体库
收藏 0 赞 0 分享

WordPress博客SEO更加完美的6个技巧

wordpress在搜索引擎优化方面做的也十分不错,在搜索引擎优化方面它基本上给我们解决了80%左右的问题,但余下的20%左右的SEO工作,还是需要人工要去做的,而且也是非常有必要的,怎么才能做好这余下的20%左右的工作呢?
收藏 0 赞 0 分享

WordPress 图片用单独域名储存方法

Yslow 提高网站加载速度里有这么一条:Used Cookie Free Domains , 大意是浏览器会对作用域内每个加载的对象传递 Cookie,在加载图像或者JS、CSS的时候最好用 Cookie-free 域名。如果没有多余的域名可以用一个子域实现,但是要设置 Coo
收藏 0 赞 0 分享

WordPress 文章摘要功能实现代码

在首页显示大量的文章内容,不但影响加载速度,而且用户体验很差。
收藏 0 赞 0 分享

Wordpress 解决注册登录死循环问题

网站(Wordpress)注册登录死循环问题解决.
收藏 0 赞 0 分享

WordPress的6种主题框架对比分析

我们大多数人都经常会碰到赶工期的问题,为了提高工作效率节省宝贵的时间, 减少不必要的重新发明新轮子的时间,WordPress各种主题框架应运而生使得主题开发变得更加快捷。
收藏 0 赞 0 分享

WordPress的.htaccess优化技巧

大家都知道页面加载速度对博客流量有非常重要的影响。最近越来越多人也在讨论页面加载速度很可能成为谷歌和其他搜索引擎一个重要的SEO因素。
收藏 0 赞 0 分享

WordPress 实现简单的企业网站

当朋友拜托你给他的公司或产品做一个简单的网站。或者你刚刚发布了一个软件,需要一个官网。或者想给你的WP blog加一个首页。
收藏 0 赞 0 分享

WordPress 标签Tags页面制作方法

Wordpress自带着wp_tag_cloud()函数,但只在页面侧边显示往往就不够了.需要一个单页来放所有的Tags
收藏 0 赞 0 分享

WordPress 发布时间超过15天的文章中展示广告

假设,我们需要在发布时间超过15天的文章中展示广告,我们今天只需要简单的设置一下代码,就能完成。
收藏 0 赞 0 分享
查看更多