Call to undefined function imagecreatefromjpeg() 让GD支持JPEG格式的图片扩展
安装扩展支持jpeg格式:
第一步:首先下载文件:
版本v8:
wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz
版本v9:
wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz 把jpeg安装到home目录:
./configure --prefix=/home/jpeg --enable-shared --enable-static
make && make install 第二步:安装到配置文件中
、找到php 源码目录
cd /home/ubuntu/downphp/php-7.0. 、进入 ext/gd 目录
cd /home/ubuntu/downphp/php-7.0./ext/gd 、执行命令:/home/php/bin/phpize
[root@daokr gd]#/home/php/bin/phpize
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No: 、注意 with-freetype-dir 路径必须加载否则报错
./configure --with-php-config=/home/php/bin/php-config --with-jpeg-dir=/home/jpeg --with-freetype-dir=/usr/local/include/freetype2 、make && make install
、重启 httpd 如果上面的步骤解决不了那就重新安装php吧: 记得把
--with-jpeg-dir=/home/jpeg 加上
重新安装phpconfig
./configure --prefix=/home/php --with-config-file-path=/home/php/etc --with-fpm-user=ubuntu --with-fpm-group=ubuntu --with-pdo-mysql --with-openssl --with-pear --with-mhash --with-xmlrpc --with-zlib --with-mcrypt --with-curl --with-jpeg-dir=/home/jpeg --with-gd --with-freetype-dir=/usr/local/include/freetype2 --without-sqlite3 --without-pdo-sqlite --disable-rpath --without-pear --enable-fpm --enable-maintainer-zts --enable-pcntl --with-tsrm-pthreads --enable-mbstring --enable-mbregex --enable-bcmath --enable-zip --enable-sockets --enable-soap --enable-gd-native-ttf --enable-xml --enable-inline-optimization --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
liconv close 错误解决:vim MakeFile
EXTRA_LIBS = -lcrypt -lz -lresolv -lcrypt -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lxml2 -lssl -lcrypto -lcurl -lxml2 -lssl -lcrypto -lfreetype -lxml2 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lxml2 -lssl -lcrypto -lcrypt -liconv
这个版本不能用imagecreatefromjpeg:
Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable
为啥呢;百度了半天没解决最后还是重新编译php安装了。
最终还是重新编译了PHP配置
./configure --prefix=/home/php --with-config-file-path=/home/php/etc --with-fpm-user=ubuntu --with-fpm-group=ubuntu --with-pdo-mysql --with-openssl --with-pear --with-mhash --with-xmlrpc --with-zlib --with-mcrypt --with-curl --with-jpeg-dir --with-png-dir --with-gd --with-freetype-dir=/usr/local/include/freetype2 --without-sqlite3 --without-pdo-sqlite --disable-rpath --without-pear --enable-fpm --enable-maintainer-zts --enable-pcntl --with-tsrm-pthreads --enable-mbstring --enable-mbregex --enable-bcmath --enable-zip --enable-sockets --enable-soap --enable-gd-native-ttf --enable-xml --enable-inline-optimization --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-ftp --with-gettext --enable-opcache
$f = 'uploads/face/010/00/00/2296f8b53a3324e528ff37cba61cb14f_240_240.jpg';
var_dump(getImageSize($f));
$a = imagecreatefromjpeg($f);
var_dump($a);die;
成功输出:
Call to undefined function imagecreatefromjpeg() 让GD支持JPEG格式的图片扩展的更多相关文章
- 一般源码安装添加的GD库 是不支持 jpeg 格式的图片的
一般源码安装添加的GD库 是不支持 jpeg 格式的图片的,只支持如下格式 GD Support enabled GD Version bundled (2.0.34 compatible) GIF ...
- 火狐不支持webp格式的图片
<!DOCTYPE html> <html lang="en"> <style> ul{list-style: none;} li{float: ...
- 超图不支持JPEG格式的WMTS服务
就目前面而言,超图不支持JPEG格式的WMTS服务,只支持PNG格式的. <本篇完>
- Linux下php+imagemagick支持webp格式的图片
摘要 ImageMagick是一款功能强大的图片处理工具包,很多互联网应用中都会涉及到图片处理工作,比如切割.缩放.水印.格式转换等.ImageMagick就是一个理想的工具包. 安装基础依赖 先检查 ...
- gd库不支持jpeg的解决方法
杜工就不在这里啰嗦怎么遇到这个问题的了,如果你确实安装了的gd库,却发现无法支持jpeg格式的图片,可从下面找到答案. 原因是在编译gd库前,配置时未声明jpeg库路径.解决方法如下: 32位系统: ...
- 在已经编译安装好php7场景下,install gd库 with free-type (解决Call to undefined function imagettftext())
在已经编译安装好php7场景下,install gd库 with free-type (解决Call to undefined function imagettftext()) install g ...
- php重新编译,gd扩展支持jpeg文件
晚上写东西的时候,报了一个错误: Call to undefined function imagecreatefromjpeg() 没有开启 jpeg 支持?原来是默认安装的 gd 扩展默认不支持 j ...
- php命令行运行出现错误Call to undefined function curl_init()
在windows命令行窗口下运行php命令,需要将php.exe所在的路径添加到Path环境变量,例如C:\wamp\bin\php\php5.4.3 启动Apache服务 在命令行中输入php te ...
- Call to undefined function think\finfo_open() 报错 解决方法
Call to undefined function think\finfo_open() 经过各方面排查,是fileinfo扩展没有安装 安装即可
随机推荐
- Linux学习笔记之tail命令显示最后n行
tail :输出文件的最后几行. 用于linux查看日志的时候很方便,假如日志文件为:Console.log用法:1. tail Console.log tail # 输出文件最后10行的内容 2. ...
- 正在阅读的tex教程
https://liam.page/2014/09/08/latex-introduction/ https://www.jianshu.com/p/1d99b3c883a6 http://www.c ...
- tf.tile()函数的用法
y = tf.tile(tf.range(2, dtype=tf.int32)[:, tf.newaxis], [2,3]) # tf.tile(input,[a,b]) 输入数据,按照对应维度将矩阵 ...
- 2019 朗玛信息java面试笔试题 (含面试题解析)
本人3年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.朗玛信息等公司offer,岗位是Java后端开发,最终选择去了朗玛信息. 面试了很多家公司,感觉大部分公司考察的点 ...
- 30个关于Shell脚本的经典案例(下)
本文目录 21.从FTP服务器下载文件 22.连续输入5个100以内的数字,统计和.最小和最大 23.将结果分别赋值给变量 24.批量修改文件名 25.统计当前目录中以.html结尾的文件总大 26. ...
- TypeScript编写Vue项目结构解析
使用TypeScript编写Vue项目也已经有了一段时间,笔者在刚刚使用TypeScript时候也是很茫然,不知道从何下手,感觉使用TypeScript写项目感觉很累赘并不像JavaScript那么灵 ...
- mvc和mvvm模式
一. Mvvm定义 MVVM是Model-View-ViewModel的简写.即模型-视图-视图模型.[模型]指的是后端传递的数据.[视图]指的是所看到的页面.[视图模型]mvvm模式的核心,它是连接 ...
- 模仿jquery--offset方法。原生JS获取任意元素到文档document顶部的距离
1.通过遍历目标节点.目标节点的父节点,依次溯源. 然后累加这些节点到其最近可定位的祖先节点的距离.向上直到document. 其中,需要使用到节点的offsetTop/offsetLeft属性,来获 ...
- 82.使用vue后怎么针对搜索引擎做SEO优化?
什么是SEO 搜索引擎优化(Search engine optimization,简称SEO),指为了提升网页在搜索引擎自然搜索结果中(非商业性推广结果)的收录数量以及排序位置而做的优化行为,是为了从 ...
- 单词eschaunge交易所eschaunge交换
Exchange of one person or thing for another; reciprocal giving and receiving: (a) of prisoners of wa ...