i am trying to add fixed height width image validation in image crud class but not succeded in it. tried below but not worked. image not uploaded but database entry done.
class ImageUploadHandler
{
========
private function has_error($uploaded_file, $file, $error) {
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
$file_size = filesize($uploaded_file);
list($width, $height, $type, $attr) = getimagesize($uploaded_file);
if($width != 600 || $height != 800){
return 'maxFileSize';
}
} else {
$file_size = $_SERVER['CONTENT_LENGTH'];
}
}
NOTE : Code working fine. but error should send to client side. i think it is not handled in image-crud.
I got succeeded into adding validation for fixed size image.(as in question i am on right track, but below code worked).
In image_crud.php class line no. 333.
list($width, $height) = getimagesize($path);
if($width != $this->max_width || $height != $this->max_height)
{
/* Commented below line */
//$ci->image_moo->load($path)->resize($this->max_width,$this->max_height)->save($path,true);
//and returned false
return false;
}