Doc #65749 [Asn->Csd]: getimagesize not returning channels for png and bmp

From: Date: Wed, 25 Sep 2013 23:00:06 +0000
Subject: Doc #65749 [Asn->Csd]: getimagesize not returning channels for png and bmp
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10310@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65749&edit=1

 ID:                 65749
 Updated by:         aharvey@php.net
 Reported by:        nettum at gmail dot com
 Summary:            getimagesize not returning channels for png and bmp
-Status:             Assigned
+Status:             Closed
 Type:               Documentation Problem
 Package:            Documentation problem
 PHP Version:        Irrelevant
 Assigned To:        aharvey
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.




Previous Comments:
------------------------------------------------------------------------
[2013-09-25 23:00:01] aharvey@php.net

Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=331495
Log: Note that channels and bits aren't mandatory return fields for getimagesize().

Fixes doc bug #65749 (getimagesize not returning channels for png and bmp).

------------------------------------------------------------------------
[2013-09-25 22:55:43] aharvey@php.net

Looks like a documentation problem, rather than a code one — the getimagesize() 
code is pretty clear that channels and bits are optional, depending on the image 
type.

------------------------------------------------------------------------
[2013-09-24 06:49:20] nettum at gmail dot com

Description:
------------
getimagesize does not contain 'channel' in the returning array when you run 
getimagesize on a PNG or BMP image.

The documentation (http://php.net/manual/en/function.getimagesize.php) specifies 
that it will always return an array with 7 elements. This does not seem to be the 
case. Se script output below.

Test script:
---------------
<?php
$file_jpg = "test.jpg";
$file_png = "tux.png";

$info_jpg = getimagesize($file_jpg);
$info_png = getimagesize($file_png);

echo "\nJPG:";
print_r($info_jpg);

echo "\nPNG:";
print_r($info_png);
?>


Expected result:
----------------
JPG:Array
(
    [0] => 463
    [1] => 399
    [2] => 2
    [3] => width="463" height="399"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)

PNG:Array
(
    [0] => 400
    [1] => 479
    [2] => 3
    [3] => width="400" height="479"
    [bits] => 8
    [channels] => 4
    [mime] => image/png
)


Actual result:
--------------
JPG:Array
(
    [0] => 463
    [1] => 399
    [2] => 2
    [3] => width="463" height="399"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)

PNG:Array
(
    [0] => 400
    [1] => 479
    [2] => 3
    [3] => width="400" height="479"
    [bits] => 8
    [mime] => image/png
)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65749&edit=1


Thread (2 messages)

« previous php.doc.bugs (#10310) next »