Jump to content

how to detect invalid jpeg format ?


miob

Recommended Posts

i do resize on some external jpegs, but sometimes i get 404 error page instead of jpeg,
but script copied it , saved it and if i do resize i get black square from it.
i have no clue how to stop resizing , or do anything with no picture,
how to detect if it's case where is no pic.

getimagesize doesn't help for me...

thanx
Link to comment
https://forums.phpfreaks.com/topic/8504-how-to-detect-invalid-jpeg-format/
Share on other sites

Fatal error: Call to undefined function: mime_content_type()

i have noticed that it happens when instead of jpeg they have 404 redirect to some html page, copy function copied it as binary file, and result is that it has nothing to do with jpeg format.

is there any chance to get it fixed without changing of php.ini ?

then i've found this

if ( ! function_exists ( 'mime_content_type ' ) )
{
function mime_content_type ( $f )
{
return system ( trim( 'file -bi ' . escapeshellarg ( $f ) ) ) ;
}
}

by adding this next function all sounds fine..

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.