Asked by      gurpreet    ·  ·   4 answers  
 You can extend the Validator class.
But anyway try this
Validator::extend('is_png',function($attribute, $value, $params, $validator) {
    $image = base64_decode($value);
    $f = finfo_open();
    $result = finfo_buffer($f, $image, FILEINFO_MIME_TYPE);
    return $result == 'image/png';
});
And then validate like this:
$rules = array(
   'image' => 'is_png'
);
0
   0 
  
  
  
  
  
  
  
  
  
 