PHP JPEG support is not configured properly the problem under PHP 5.3.x

來源:互聯網
上載者:User

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).

view source

print?

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

view source

print?

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

in

view source

print?

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

und Zeile 59 von

view source

print?

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

in

view source

print?

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

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.