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

所属分类: CMS教程 / WordPress 阅读数: 2175
收藏 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后台中的侧边栏添加菜单或子菜单的方法

在后台中的侧边栏添加菜单或子菜单。比如向已经存在的菜单中添加子菜单等等,具体的实现如下,感兴趣的朋友可以参考下
收藏 0 赞 0 分享

WordPress中的__()和_e()函数的作用介绍

在WordPress 中,__()函数和__e()函数被用来识别php文件中被标示的、需要被翻译成其它语言或本地化的字符串,两者唯一功能性区别如下,感兴趣的朋友可以参考下
收藏 0 赞 0 分享

wordpress主题制作涉及到的基本模板及说明整理

主题制作过程难免会涉及到一些常用基本的模板,本文整理了一些并附带说明,有需要的朋友可以参考下,希望对大家有所帮助
收藏 0 赞 0 分享

WordPress在线安装主题、插件及快速发布上传图片时提示错误

正如标题所言主要是因为空间中的C:\WINDOWS\TEMP目录没有设置IIS访问权限,所以我们只能改变WordPress的上传临时目录,具体修改步骤如下,有类似问题的朋友可以参考下
收藏 0 赞 0 分享

WordPress数据备份心得分享

服务器钱用光了要关了或者是服务器想要搬家,需要备份各种数据,今天备份了一下在服务器上面wordpress各种文件和资源,在此与大分享下,感兴趣的朋友不妨看看或对以后有所帮助
收藏 0 赞 0 分享

WordPress简单三步实现首页文章显示缩略图(无插件)

想在首页文章中显示缩略图,有插件可以实现,不过不方便操作和控制,毕竟代码是人家写的,今天与大家分享一下,无插件,纯代码是怎么实现首页文章缩略图的
收藏 0 赞 0 分享

wordpress模板页面判断函数(自己整理)

wordpress模板页面判断函数,自己平时用到的整理一下,现在拿出来与大家分享,以备不时之需
收藏 0 赞 0 分享

WordPress主题结构是如何架构的图文剖析

WordPress主题开发人员只要精通HTML,PHP,JS,CSS等技术,握WordPress主题的框架就可以将基于WordPress的网站做成各种各样的形式,下面与大家分析下WordPress是如何架构
收藏 0 赞 0 分享

WordPress博客服务器环境配置

早就想搭建一个专属于自己的博客了,用来记录自己生活、学习的点点滴滴。今天说的是WordPress博客安装和服务器务器环境配置。之所以选WordPress,主要是因为它可以支持Latex,而且特别喜欢其简约的风格。
收藏 0 赞 0 分享

wordpress随机文章/随机推荐的实现思路与用法

wordpress随机文章及随机推荐解脱了手动推荐,很多新接触wordpress的朋友可能对此功能不是很熟悉,本文详细介绍一些此功能的实现步骤,感兴趣的朋友可以了解下
收藏 0 赞 0 分享
查看更多