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: Open
+Status: Assigned
-Type: Bug
+Type: Documentation Problem
-Package: GetImageSize related
+Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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