Can someone help me edit the code for limiting image dimensions

Add new plugin maybe considered as uploading file.
Check if the file uploaded is an image or not before handling

if(@!is_array(getimagesize($mediapath))){
    $image = true;
} 
else {
    $image = false;
}

Thanks to: https://stackoverflow.com/questions/15408125/php-check-if-file-is-an-image
So, modify your code to

function mdu_validate_image_size( $file ) {
   $image = getimagesize($file['tmp_name']);
   if(@!is_array(getimagesize($image))){//check if file is an image
     //do stuff
   }
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)