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
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..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.