简体   繁体   中英

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?

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.

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');

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM