<legend id='40oK9'><style id='40oK9'><dir id='40oK9'><q id='40oK9'></q></dir></style></legend>
  • <tfoot id='40oK9'></tfoot>
      <i id='40oK9'><tr id='40oK9'><dt id='40oK9'><q id='40oK9'><span id='40oK9'><b id='40oK9'><form id='40oK9'><ins id='40oK9'></ins><ul id='40oK9'></ul><sub id='40oK9'></sub></form><legend id='40oK9'></legend><bdo id='40oK9'><pre id='40oK9'><center id='40oK9'></center></pre></bdo></b><th id='40oK9'></th></span></q></dt></tr></i><div id='40oK9'><tfoot id='40oK9'></tfoot><dl id='40oK9'><fieldset id='40oK9'></fieldset></dl></div>
    1. <small id='40oK9'></small><noframes id='40oK9'>

      • <bdo id='40oK9'></bdo><ul id='40oK9'></ul>

        可怕的“警告:imagecreatefromjpeg() : '/tmp/filename' 不是第 x

        the dreaded quot;Warning: imagecreatefromjpeg() : #39;/tmp/filename#39; is not a valid JPEG file in /phpfile.php on line xxxquot;(可怕的“警告:imagecreatefromjpeg() : /tmp/filename 不是第 xxx 行/phpfile.php 中的有效 JPEG 文件) - IT屋-程序员
          • <tfoot id='dYEaP'></tfoot>
            1. <small id='dYEaP'></small><noframes id='dYEaP'>

              <legend id='dYEaP'><style id='dYEaP'><dir id='dYEaP'><q id='dYEaP'></q></dir></style></legend>

                <tbody id='dYEaP'></tbody>
                <bdo id='dYEaP'></bdo><ul id='dYEaP'></ul>

                <i id='dYEaP'><tr id='dYEaP'><dt id='dYEaP'><q id='dYEaP'><span id='dYEaP'><b id='dYEaP'><form id='dYEaP'><ins id='dYEaP'></ins><ul id='dYEaP'></ul><sub id='dYEaP'></sub></form><legend id='dYEaP'></legend><bdo id='dYEaP'><pre id='dYEaP'><center id='dYEaP'></center></pre></bdo></b><th id='dYEaP'></th></span></q></dt></tr></i><div id='dYEaP'><tfoot id='dYEaP'></tfoot><dl id='dYEaP'><fieldset id='dYEaP'></fieldset></dl></div>

                  本文介绍了可怕的“警告:imagecreatefromjpeg() : '/tmp/filename' 不是第 xxx 行/phpfile.php 中的有效 JPEG 文件"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当有人将图片上传到我们的网站时,我收到了这个警告:

                  I've been getting this warning when some people upload images to our site :

                  警告:imagecreatefromjpeg()[function.imagecreatefromjpeg]:gd-jpeg:JPEG 库报告不可恢复的错误:在/home/pathremoved/includes/snapsutils.php第220行

                  Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/pathremoved/includes/snapsutils.php on line 220

                  警告:imagecreatefromjpeg()[function.imagecreatefromjpeg]:'/tmp/phpiw4MFk' 不是有效的 JPEG/home/pathremoved.php 中的文件在线220

                  Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '/tmp/phpiw4MFk' is not a valid JPEG file in /home/pathremoved.php on line 220

                  警告:imagesx():提供的参数不是有效的图像资源/home/pathremoved.php 第 222 行

                  Warning: imagesx(): supplied argument is not a valid Image resource in /home/pathremoved.php on line 222

                  警告:imagesy():提供的参数不是有效的图像资源/home/pathremoved.php 第 223 行

                  Warning: imagesy(): supplied argument is not a valid Image resource in /home/pathremoved.php on line 223

                  警告:imagecreatetruecolor()[function.imagecreatetruecolor]:图像尺寸无效/home/pathremoved.php 第 240 行

                  Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/pathremoved.php on line 240

                  警告:imagecopyresampled():提供的参数不是有效的图像/home/pathremoved.php 中的资源第 242 行

                  Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/pathremoved.php on line 242

                  这仅发生在某些图像上,当在任何程序中打开时都可以,它甚至可以毫无问题地上传到我在 localhost 上的网站版本...我用谷歌搜索了一下,但没有发现任何结论...

                  This only happens with certain images, which when opened in any program are ok, it even uploads to the version of the site I have on localhost with no problems...I googled a bit but found nothing conclusive...

                  注意 php upload_max 大小为 5M,post_max_size 为 5M.这不是上传或内存问题.我已经用 400 万张图片进行了测试,没有任何问题.

                  note php upload_max size is 5M and post_max_size is 5M. This is not an upload or memory issue. I've tested with 4M images without problems.

                  任何帮助表示赞赏.

                  推荐答案

                  在 Google 上搜索了一下后,我发现 此错误报告.似乎 GD 库对有缺陷的 JPEG 文件的容忍度低于其他程序.建议的解决方案是在处理图像之前将 GD 设置为忽略 JPEG 错误,如下所示:

                  After a little digging around on Google I found this bug report. It seems that the GD library is less tolerant of buggy JPEG files than other programs. The solution suggested was to set GD to ignore JPEG error's before processing the image, like this:

                  ini_set("gd.jpeg_ignore_warning", 1);
                  

                  希望这对你有用.您可能遇到的另一个潜在问题与内存有关.似乎 GD 将所有图像在打开后作为位图保存在内存中.这意味着 5MB 的图像实际上可以消耗比单个 PHP 线程所允许的更多的内存,从而导致致命错误.我在上传一些图片时遇到了这个问题,为了解决这个问题,我不得不减小允许的最大文件大小.

                  Hopefully that will work for you. One other potential problem you may run into is to do with memory. It seems that GD holds all images in memory as bitmaps once they've been opened. This means that a 5MB image can actually consume more memory than a single PHP thread is allowed, resulting in a fatal error. I had this problem with some image uploads and had to reduce the maximum file size I allowed to get around the problem.

                  祝你好运,希望对你有所帮助.

                  Good luck and hope that helps.

                  这篇关于可怕的“警告:imagecreatefromjpeg() : '/tmp/filename' 不是第 xxx 行/phpfile.php 中的有效 JPEG 文件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <small id='Bgqr5'></small><noframes id='Bgqr5'>

                      <bdo id='Bgqr5'></bdo><ul id='Bgqr5'></ul>
                      • <tfoot id='Bgqr5'></tfoot>
                        <i id='Bgqr5'><tr id='Bgqr5'><dt id='Bgqr5'><q id='Bgqr5'><span id='Bgqr5'><b id='Bgqr5'><form id='Bgqr5'><ins id='Bgqr5'></ins><ul id='Bgqr5'></ul><sub id='Bgqr5'></sub></form><legend id='Bgqr5'></legend><bdo id='Bgqr5'><pre id='Bgqr5'><center id='Bgqr5'></center></pre></bdo></b><th id='Bgqr5'></th></span></q></dt></tr></i><div id='Bgqr5'><tfoot id='Bgqr5'></tfoot><dl id='Bgqr5'><fieldset id='Bgqr5'></fieldset></dl></div>
                          <tbody id='Bgqr5'></tbody>
                          <legend id='Bgqr5'><style id='Bgqr5'><dir id='Bgqr5'><q id='Bgqr5'></q></dir></style></legend>