Check if image exists in folder or not currupted in php::$full_path = Full Image path; (Like: ../dd/tmp.jpg) if(!file_exists($full_path)){ //Image Not Available or Not Exists }else{ //Image File Exists //Check if image not damaged. $ext = strtolower(pathinfo($full_path, PATHINFO_EXTENSION)); if ($ext === 'jpg') { $ext = 'jpeg'; } $function = 'imagecreatefrom' . $ext; if (function_exists($function) && @$function($full_path) === FALSE) { //Image Is Corrupted or Damaged. }else{ // Image is Ok } }
$full_path = Full Image path; (Like: ../dd/tmp.jpg)
if(!file_exists($full_path)){
//Image Not Available or Not Exists
}else{
//Image File Exists
//Check if image not damaged.
$ext = strtolower(pathinfo($full_path, PATHINFO_EXTENSION));
if ($ext === 'jpg') { $ext = 'jpeg'; }
$function = 'imagecreatefrom' . $ext;
if (function_exists($function) && @$function($full_path) === FALSE)
{
//Image Is Corrupted or Damaged.
}else{
// Image is Ok
}
}