Jump to content

Help with identifying JPEG


mat3000000

Recommended Posts

check the extension. by exploding the file name.

$string = "lala.mama.jaja.yaya.tata.moemoe.jpg";

$myarray = explode('.', $string);

$extension = $myarray[count($myarray)-1]; // gets the last part
echo $extension; // outputs jpg

From there on you only need to check the value of $extension to what you expect, in this case a jpg.

 

or do something like this:

 

 echo substr(basename($string), -3); // outputs jpg 

 

The getimagesize returned index [2] is an integer (the IMAGETYPE_JPEG defined constant has the value 2.) Index [4] is the mime type.

 

I would troubleshoot what value you are getting by using var_dump() on the returned value and given that you have an @ on the getimagesize statement to suppress errors, it is likely some other problem is occurring before that point. What php error, if any, do you get when you remove the @?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.