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

所属分类: CMS教程 / WordPress 阅读数: 2150
收藏 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修改新用户注册邮件内容的方法

这篇文章主要为大家介绍了WordPress修改新用户注册邮件内容的方法,介绍了两种方法可实现针对注册邮箱内容的个性化修改,是比较实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress添加前台注册功能的方法

这篇文章主要为大家介绍了WordPress添加前台注册功能的方法,较为详细的分析了前台注册功能的完整实现过程,是进行WordPress开发非常实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress用户自动登录的实现方法

这篇文章主要为大家介绍了WordPress用户自动登录的实现方法,只需用户名而不需要密码即可实现用户自动登录的功能,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress后台删除不需要的侧边栏菜单方法

这篇文章主要为大家介绍了WordPress后台删除不需要的侧边栏菜单方法,通过添加自定义函数结合对应的菜单项删除不需要的菜单项,以实现对菜单的选取功能,需要的朋友可以参考下
收藏 0 赞 0 分享

禁止WordPress自动替换半角标点符号的方法

这篇文章主要为大家介绍了禁止WordPress自动替换半角标点符号的方法,只需将底层代码中关于半角标点符号替换的功能函数注释掉即可,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress获取当前页面URL地址的方法

这篇文章主要为大家介绍了WordPress获取当前页面URL地址的方法,给出了WordPress原生方法与自定义方法,是非常实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress实现退出登录后跳转到指定页面的方法

这篇文章主要为大家介绍了WordPress实现退出登录后跳转到指定页面的方法,可实现针对指定页面、首页及当前页面的跳转功能,是建站时非常实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

Wordpress实现单篇文章分页显示的方法

这篇文章主要为大家介绍了Wordpress实现单篇文章分页显示的方法,分析了文章页面的分页原理与对应js文件的修改方法,是非常实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

Wordpress中上一篇与下一篇功能代码

这篇文章主要为大家介绍了Wordpress中上一篇与下一篇功能代码,并对其函数的具体参数进行了较为详细的介绍,是非常实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多