PHP JPEG support isn't configured properly the problem under PHP 5.3.x

Source: Internet
Author: User
Tags zend framework
Aufgefallen ist mir diesem Problem beim Aufsetzten eines Magento online-shops, der nach einem Upgrade auf PHP 5.3.1 Plötzl Ich 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 P HP 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

View Source print?

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

Inch

View Source print?

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

und Zeile-Von

View Source print?

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

Inch

View Source print?

1 if ((Imagetypes () & img_jpg) = = 0) {

Abändern Fertig! Nun sollte alles wieder wie gewohnt arbeiten.

?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.