백엔드 개발 PHP 튜토리얼 PHP JPEG support is not configured properly the problem under PHP 5.3.x

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

Jun 23, 2016 pm 02:29 PM

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.

?

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

뜨거운 기사 태그

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

11 최고의 PHP URL 쇼트너 스크립트 (무료 및 프리미엄) 11 최고의 PHP URL 쇼트너 스크립트 (무료 및 프리미엄) Mar 03, 2025 am 10:49 AM

11 최고의 PHP URL 쇼트너 스크립트 (무료 및 프리미엄)

Laravel의 플래시 세션 데이터로 작업합니다 Laravel의 플래시 세션 데이터로 작업합니다 Mar 12, 2025 pm 05:08 PM

Laravel의 플래시 세션 데이터로 작업합니다

Laravel 테스트에서 단순화 된 HTTP 응답 조롱 Laravel 테스트에서 단순화 된 HTTP 응답 조롱 Mar 12, 2025 pm 05:09 PM

Laravel 테스트에서 단순화 된 HTTP 응답 조롱

Instagram API 소개 Instagram API 소개 Mar 02, 2025 am 09:32 AM

Instagram API 소개

Laravel Back End : Part 2, React가있는 React 앱 구축 Laravel Back End : Part 2, React가있는 React 앱 구축 Mar 04, 2025 am 09:33 AM

Laravel Back End : Part 2, React가있는 React 앱 구축

PHP의 컬 : REST API에서 PHP Curl Extension 사용 방법 PHP의 컬 : REST API에서 PHP Curl Extension 사용 방법 Mar 14, 2025 am 11:42 AM

PHP의 컬 : REST API에서 PHP Curl Extension 사용 방법

Codecanyon에서 12 개의 최고의 PHP 채팅 스크립트 Codecanyon에서 12 개의 최고의 PHP 채팅 스크립트 Mar 13, 2025 pm 12:08 PM

Codecanyon에서 12 개의 최고의 PHP 채팅 스크립트

2025 PHP 상황 조사 발표 2025 PHP 상황 조사 발표 Mar 03, 2025 pm 04:20 PM

2025 PHP 상황 조사 발표

See all articles