Codeigniter上传库来验证图像的最小宽度和最小高度


Codeigniter upload library to validate min width and min height of image

我正在使用codeigniter中的上传库来上传图像........

$config[‘allowed_types’]    = ‘gif|png|jpg’;
$config[‘max_size’]      = ‘1000’;
$config[‘max_width’]      = ‘200’;
$config[‘max_heigth’]      = ‘200’;
$config[‘upload_path’]    = ‘./uploads/’
$this->load->library(‘upload’, $config);

当用户上传图像........用户应上传最小宽度和最小高度

这个怎么做.........

CI只有max_width和max_height .........我也知道这个功能

 getimagesize();

但是要使用这个函数,我们需要源图像url…我没有权限…

使用下一段代码:

$data = $this->upload->data();
list($width, $height) = getimagesize($data['full_path']);

你应该在上传文件之前使用JavaScript来确定文件的大小,因为PHP不能这样做,因为它是服务器端而不是客户端。