tags:

views:

42

answers:

2

I would like to test if *.ico images are valid icons in PHP. I tried to use getimagesize function but it doesn't support ICO files.

+1  A: 

ico files are mainly image files, if you change a jpeg or gif/png into ico extension it works fine,so if you keep image type cheking it will do the job

dip1232001
or you can check the mime type which is "image/x-icon"
dip1232001
this is not what I want, I need to check them because I downloaded some from net with CURL and they're sometimes 404 pages
chubbyk
i didn't got you ,i assume the you have downloaded icos from internet some of them are corrupted but still showing as ico files, in that case check the mime type for "image/x-icon"
dip1232001
+3  A: 

http://en.wikipedia.org/wiki/ICO_(file_format)

icon must start with the '0x00 0x00 0x01 0x00' bytes, it shall be enough for simple test.

Yossarian