php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39923 Undefined constants IMG_PNG, IMG_JPG, IMG_GIF
Submitted: 2006-12-21 14:33 UTC Modified: 2006-12-21 15:19 UTC
From: smlerman at gmail dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.2.0 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: smlerman at gmail dot com
New email:
PHP Version: OS:

 

 [2006-12-21 14:33 UTC] smlerman at gmail dot com
Description:
------------
The constants IMG_PNG, IMG_JPG, and IMG_GIF are reported as undefined. IMAGETYPE_PNG, IMAGETYPE_JPEG, and IMAGETYPE_GIF all work fine. If the IMG_ constants were removed intentionally in favor of the IMAGETYPE_ constants, this is just a documentation issue.

Reproduce code:
---------------
<?php

echo IMG_PNG . "\n";
echo IMG_JPG . "\n";
echo IMG_GIF . "\n";

echo IMAGETYPE_PNG . "\n";
echo IMAGETYPE_JPEG . "\n";
echo IMAGETYPE_GIF . "\n";

?>

Expected result:
----------------
3
2
1
3
2
1

Actual result:
--------------
Notice: Use of undefined constant IMG_PNG - assumed 'IMG_PNG' in test.php on line 3
IMG_PNG

Notice: Use of undefined constant IMG_JPG - assumed 'IMG_JPG' in test.php on line 4
IMG_JPG

Notice: Use of undefined constant IMG_GIF - assumed 'IMG_GIF' in test.php on line 5
IMG_GIF
3
2
1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-21 14:35 UTC] tony2001@php.net
IMG_* constants are defined in GD which is obviously not enabled in your installation.

 [2006-12-21 14:42 UTC] smlerman at gmail dot com
Nope, GD is enabled and working fine.

GD Support 	enabled
GD Version 	bundled (2.0.28 compatible)
FreeType Support 	enabled
FreeType Linkage 	with freetype
FreeType Version 	2.1.9
T1Lib Support 	enabled
GIF Read Support 	enabled
GIF Create Support 	enabled
JPG Support 	enabled
PNG Support 	enabled
WBMP Support 	enabled
XBM Support 	enabled


(Sorry about the summary. Browser must have auto-filled it without my noticing)
 [2006-12-21 14:55 UTC] smlerman at gmail dot com
Weird, I can't reproduce it now. The original error message was "[21-Dec-2006 09:13:50] PHP Notice:  Use of undefined constant IMG_PNG - assumed 'IMG_PNG' in...", but all of the images that should be on the page showed up fine. Might have been a glitch with the 5.2.0 upgrade process. I'll reopen if I manage to reproduce.
 [2006-12-21 14:57 UTC] tony2001@php.net
This is impossible. 
These constants are defined in GD extension and if they are not, then the extension is missing.

 [2006-12-21 15:19 UTC] smlerman at gmail dot com
Yeah, that's what made me think they had maybe been deprecated. Also, the IMAGETYPE_ constants seemed to work fine, and I assumed that those were also defined in GD.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC