zoukankan      html  css  js  c++  java
  • PHP JPEG support is not configured properly the problem under PHP 5.3.x

    Aufgefallen ist mir diesem Problem beim Aufsetzten eines Magento Online-Shops, der nach einem Upgrade auf PHP 5.3.1 plötzlich keine PDFs mehr produzieren konnte. Statt dessen nu lapidar den Dienst mit folgender Fehlermeldung quittierte.

    Undefined index: JPG Support in /usr/local/lib/php/Zend/Pdf/Resource/Image/Jpeg.php on line 60

    Eine Befragung des Google-Orakels brachte dann auch schnell Linderung. Schuld ist wohl eine Änderung einens Strings der die API-Fähigkeiten beschreibt. So änderte sich “JPG” in “JPEG“, was dazu führt das das Zend Framework plötzlich der Meinung ist das das drunterliegende PHP nicht mehr richtig in der Lage ist JPG-Grafiken zu verarbeiten.

     Im Bugtracker des Zendframeworks hat man auch gleich einen kleinen Patch parat (BUG ZF6715).

    01 Index: library/Zend/Pdf/Resource/Image/Jpeg.php
    02 ===================================================================
    03 --- library/Zend/Pdf/Resource/Image/Jpeg.php    (revision 18072)
    04 +++ library/Zend/Pdf/Resource/Image/Jpeg.php    (working copy)
    05 @@ -52,13 +52,13 @@
    06       */
    07      public function __construct($imageFileName)
    08      {
    09 -        if (!function_exists('gd_info')) {
    10 +        if (!function_exists('gd_info') || !function_exists('imagetypes')) {
    11              require_once 'Zend/Pdf/Exception.php';
    12              throw new Zend_Pdf_Exception('Image extension is not installed.');
    13          }
    14  
    15          $gd_options = gd_info();
    16 -        if (!$gd_options['JPG Support'] ) {
    17 +        if ((imagetypes() & IMG_JPG) == 0) {
    18              require_once 'Zend/Pdf/Exception.php';
    19              throw new Zend_Pdf_Exception('JPG support is not configured properly.');
    20          }

    Wie man sehen kann ändern sich nur zwei Zeilen in der Datei Zend/Pdf/Resource/Image/Jpeg.php das kann man auch leicht mit einem einfachen Editor wie nano, vim oder mc manuell ausführen. Dazu in genannter Datei die Zeile 53 von

    1 if (!function_exists('gd_info')) {

    in

    1 if (!function_exists('gd_info') || !function_exists('imagetypes')) {

    und Zeile 59 von

    1 if (!$gd_options['JPG Support'] ) {

    in

    1 if ((imagetypes() & IMG_JPG) == 0) {

    abändern fertig ! Nun sollte alles wieder wie gewohnt arbeiten.

    

  • 相关阅读:
    WIn7 磁盘分区工具试用记录
    DirectShow 开发环境搭建(整理)
    WinCE 在连续创建约 1000 个文件后,再创建文件失败。这是为什么???
    在命令行处理 console 应用执行的返回值
    WinCE 的发展史及相关基础知识
    DirectShow Filter 基础与简单的示例程序
    使用 VS2005 编译 directshow sample 时链接错误
    车载系统之 Windows CE 应用软件框架设计
    兰州烧饼
    对决
  • 原文地址:https://www.cnblogs.com/zcy_soft/p/1873409.html
Copyright © 2011-2022 走看看