首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >imagecreatefromjpeg() -序列JPEG的无效SOS参数

问imagecreatefromjpeg() -序列JPEG的无效SOS参数
EN

Stack Overflow用户
提问于 2016-06-28 19:42:49
回答 1查看 2.6K关注 0票数 1

我不能上传图像与代码点火器,并得到以下错误。

遇到错误 严重程度:警告 消息: imagecreatefromjpeg():gd- JPEG,libjpeg:可恢复错误:序列JPEG的无效SOS参数 文件名:库/Image_lib.php 线路号码: 1455 遇到错误 严重程度:警告 消息: imagecreatefromjpeg():'/home/gsgsadh/public_html/uploads/a31d12f51b36659f5456e2530237e779.jpg‘不是有效的JPEG文件 文件名:库/Image_lib.php 线路号码: 1455

application/libraries/MY_Image_lib.php的函数image_create_gd

代码语言:javascript
复制
public function image_create_gd($path = '', $image_type = '')
{
    if ($path === '')
    {
        $path = $this->full_src_path;
    }

    if ($image_type === '')
    {
        $image_type = $this->image_type;
    }

    switch ($image_type)
    {
        case 1:
            if ( ! function_exists('imagecreatefromgif'))
            {
                $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
                return FALSE;
            }

            return imagecreatefromgif($path);
        case 2:
            if ( ! function_exists('imagecreatefromjpeg'))
            {
                $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
                return FALSE;
            }

/*No.1455*/  return imagecreatefromjpeg($path); //****Line number is 1455****
        case 3:
            if ( ! function_exists('imagecreatefrompng'))
            {
                $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
                return FALSE;
            }

            return imagecreatefrompng($path);
        default:
            $this->set_error(array('imglib_unsupported_imagecreate'));
            return FALSE;
    }
}

解决办法是什么?如何更改代码?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-20 09:50:09

将PHP设置为忽略jpeg警告

代码语言:javascript
复制
ini_set ('gd.jpeg_ignore_warning', 1);

在从just ()调用imagecreatefromjpeg之前的行中

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38084987

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档