这是我用来上传图片的代码。
$this->load->library('upload');
$ext = pathinfo($file_name, PATHINFO_EXTENSION);
$img_name = now() . "." . $ext;
$imgConfig['upload_path'] = $this->image_path;
$imgConfig['file_name'] = $img_name;
$imgConfig['max_size'] = '2048';
$imgConfig['allowed_types'] = 'jpg|png|bmp';
$imgConfig['overwrite'] = FALSE;
$this->upload->initialize($imgConfig);
if ($this->upload->do_upload("image_url")) {
$this->Playlist_model->update_playlist($insert_id, array("image_url" => $img_name));
}
前端只是一个
<input type = 'file' >
问题是,由于图片上传应该是视频缩略图,我应该怎么做才能实现上传?例如在前端使用插件来限制/裁剪(任何建议)
另外,在服务器端我该如何检查?
最佳答案
maintain_ratio
它是你保持比例的偏好
Specifies whether to maintain the original aspect ratio when resizing or use hard values.
更多详情
关于php - 如何限制上传图片比例为16 :9 in codeigniter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31369968/