Remember that the output of the function is an array, so that your code snippet, if followed by an “echo $size;” line, will produce no useful information (it will just print “Array”")
I can’t duplicate your error - it seems to work fine for me, so I can only assume that there is some problem with your parameter “filename”.
All the typical suspects come into play here:
is the path correct?
The file must exist in the path referenced.
If you have the file “image.png” in the same directory as your script, you need to loose the “/” before the filename and, in that case, the following code will work (note: ugly, incomplete, and sloppy code follows, only to show the working of the function ):
list($width, $height, $type, $attr) = getimagesize("image.png");
echo "<img src=\"image.png\" $attr alt=\"getimagesize() example\" />,<br />";
echo "$width <br />" ;
echo "$height <br />" ;
echo "$type <br />";
echo "$attr <br />";
Here is that code demonstrated working, with a different image.