shin
shin

Reputation: 1681

getimagesize function does not working

Images in my website is located in other server. I tried to get the size of an image using getimagesize of php and it is not working. It gives an error 'getimagesize is not seekable'. I tried this same function from other server(images are in same server and I change the location of the file, which is using getimagesize function) and it worked. Can anyone solve this?

Upvotes: 4

Views: 8216

Answers (3)

GianFS
GianFS

Reputation: 2615

maybe the image path is wrong

try using this instead:

dirname($_SERVER['SCRIPT_FILENAME'])

it will return the parent directory's path,

example:

getimagesize(dirname($_SERVER['SCRIPT_FILENAME']).'/images/sampleimage.jpg');

Upvotes: 0

Wrikken
Wrikken

Reputation: 70540

From the manual:

filename
This parameter specifies the file you wish to retrieve information about. It can reference a local file or (configuration permitting) a remote file using one of the supported streams.

The settings they're talking about (for the HTTP wrappers) is for the most part having allow_url_fopen enabled or disabled.

Upvotes: 5

Arc
Arc

Reputation: 11306

The error is probably could not make seekable and could mean that PHP / GD cannot recognize the image file as such.

Have you tried with different images and different image formats (GIF, JPG, PNG) ?

Maybe GIF or PNG is not supported by your PHP version.

Upvotes: 0

Related Questions