Page 1 of 1

getimagesize() not working for jpx images

Posted: Wed May 06, 2015 8:16 am
by dimxasnewfrozen
I'm trying to validate JPX images using the getimagesize() method. No matter the file, the result is always null. It's working fine for jp2 images, tiff images, and other formats. The PHP documentation says it should support JPX images but I can't seem to get it working.

I'm simply just doing this:

Code: Select all

$info = getimagesize("bx_1323.jpx");
var_dump($info);
I've tried with about 5 different jpx images. I've inspected the headers of the files and they all seem valid.

Re: getimagesize() not working for jpx images

Posted: Wed May 06, 2015 10:18 am
by Christopher
What version of PHP are you using? Perhaps it is an older version that does not support .jpx yet? Have you checked that there is no error with your image?

You could also try finfo_file().

Re: getimagesize() not working for jpx images

Posted: Wed May 06, 2015 10:27 am
by dimxasnewfrozen
I've tried on both 5.4 and 5.5.12 and get the same result (null). I can open the jpx images fine with different image viewers.

I was originally looking into finfo_file() but I keep getting "application/octet-stream" for everything.

Re: getimagesize() not working for jpx images

Posted: Wed May 06, 2015 3:43 pm
by Christopher
Is there something wrong with the file or permissions? getimagesize() should return an array or false, not null. Do you have error reporting on enough so that you know you don't have some error happening?

Re: getimagesize() not working for jpx images

Posted: Wed May 06, 2015 3:46 pm
by dimxasnewfrozen
No errors reported. I haven't touched the permissions but I'd assume they're okay since other files work fine.

Re: getimagesize() not working for jpx images

Posted: Wed May 06, 2015 5:05 pm
by requinix
Can you post the image?