php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65536 getimagesize() returning wrong value for IMG_PNG
Submitted: 2013-08-23 23:23 UTC Modified: 2013-08-24 00:58 UTC
From: hammadullahkhan at gmail dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.4.19 OS: windows
Private report: No CVE-ID: None
 [2013-08-23 23:23 UTC] hammadullahkhan at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.getimagesize#refsect1-function.getimagesize-returnvalues
---

Hi,

Just noticed that getimagesize() is returning wrong value in case of PNG:
Array
(
    [0] => 1125
    [1] => 651
    [2] => 3
    [3] => width="1125" height="651"
    [bits] => 8
    [mime] => image/png
)

[2] => should return 4


As per: 
gd.php line 1805
define ('IMG_PNG', 4);


Test script:
---------------
$imgInfo = getimagesize("test.png");

if ($imgInfo[2] == IMG_PNG)
{
   echo "CONDITION SHOULD BE WORKING AS PER gd.php";
} 
else
{
   echo "CONDITION NOT WORKING";
}

Expected result:
----------------
CONDITION SHOULD BE WORKING AS PER gd.php

Actual result:
--------------
CONDITION NOT WORKING

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-24 00:58 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2013-08-24 00:58 UTC] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

[2] is an IMAGETYPE constant, not an IMG constant.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 13:01:29 2024 UTC