Hello,
I am having problem with getimagesize() function.
In the script I was trying to get image size( height and width)

My code looked this way
$size = getimagesize($image_name);
$width = $size[0];
$height = $size[1];

both $width and $height returns empty string.

I have looked at

http://us3.php.net/manual/en/function.getimagesize.php

Also I tried to use function that they offer
sgetimagesize(filename) and that did not work either.

Images are not large
Any other suggestions?

    does your form tag have an enctype which allow the uploading of images ?

    paul

      Is $image_name the name of a file? And is that file an image? Is the image a recognised format?

        Thank you for the reply,
        I am not using forms there at al. I am using images as links to somewhere else. DOes that function works only with forms?

        Also
        $image_name is the name of the file. The file is image and the format of it is jpeg format.

          list($width, $height)=getimagesize("$image_name");

          then echo it out

          <img src=\"$image_name\" width=\"$width\" height=\"$height\" alt=\" \" border=\"0\" />

            Try
            if(!file_exists($image_name)) echo "File not found.";

            (I.e., is PHP looking where you want it to?)

            Then

            $size=getimagesize($image_name);
            var_dump($size);

            I have seen earlier versions of PHP (I forget which; it was a while ago) that weren't able to recognise certain jpegs (from Casio cameras in this case). That's the only other reason I can think of right now for a failure.

              It does not matter if I use list(height, weight). The problem is that function getimagesize() returns null.

                FOund the problem. As always - syntax error. Thank you for all the help
                Kindly
                Alex

                  Write a Reply...