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

    2015-12-09 10:08     0 条评论

查看是否安装了PHP-GD

使用php探针(在服务器端新建一个info.php文件,输入phpinfo()php代码,然后通过客户端访问该php脚本),查看是否安装了php-gd,假如安装了php-gd,则会显示如下信息:

假如没有安装,则输入以下命令执行安装操作:

apt-get install php5-gd

执行命令后,输出类似于:

apt-get install php5-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libgd2-xpm
Suggested packages:
  libgd-tools
The following packages will be REMOVED:
  libgd2-noxpm
The following NEW packages will be installed:
  libgd2-xpm php5-gd
0 upgraded, 2 newly installed, 1 to remove and 7 not upgraded.
Need to get 270 kB of archives.
After this operation, 176 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://debian.osuosl.org/debian/ squeeze/main libgd2-xpm amd64 2.0.36~rc1~dfsg-5 [231 kB]
Get:2 http://security.debian.org/ squeeze/updates/main php5-gd amd64 5.3.3-7+squeeze9 [39.1 kB]
Fetched 270 kB in 2s (124 kB/s)
dpkg: libgd2-noxpm: dependency problems, but removing anyway as you requested:
 libgvc5 depends on libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg); however:
  Package libgd2-noxpm is to be removed.
  Package libgd2-xpm is not installed.
(Reading database ... 206928 files and directories currently installed.)
Removing libgd2-noxpm ...
Selecting previously deselected package libgd2-xpm.
(Reading database ... 206919 files and directories currently installed.)
Unpacking libgd2-xpm (from .../libgd2-xpm_2.0.36~rc1~dfsg-5_amd64.deb) ...
Setting up libgd2-xpm (2.0.36~rc1~dfsg-5) ...
Selecting previously deselected package php5-gd.
(Reading database ... 206930 files and directories currently installed.)
Unpacking php5-gd (from .../php5-gd_5.3.3-7+squeeze9_amd64.deb) ...
Processing triggers for libapache2-mod-php5 ...
Reloading web server config: apache2.
Setting up php5-gd (5.3.3-7+squeeze9) ...

安装完成之后,重启nginx或者Apache服务器,再使用php探针查看是否安装成功,笔者使用的Linux服务器上,安装完php-gd后,重启nginx服务器,查看探针,发现不会生效,通过重启服务器系统之后,就生效了。

服务器PHP-GD已经生效,但还是不生成缩略图

有可能是你设置了不生成缩略图(WordPress默认是生成缩略图的),你可以进入Dashboard进行设置,具体设置如下:

设置 -> 多媒体。查看生成缩略图选项是否勾选上。

本文地址:https://www.yhawaii.net/wordpress-can-not-generate-thumbnail-image.html
版权声明:本文为原创文章,版权归  所有,欢迎分享本文,转载请保留出处!

 发表评论


表情