Browse Source

限制太小

master
wanghongjun 3 years ago
parent
commit
2ae4db19ef
  1. 26
      app/controller/RotationChart.php

26
app/controller/RotationChart.php

@ -111,20 +111,20 @@ class RotationChart extends BaseController
try { try {
$rule = [ $rule = [
'image' => [ 'image' => [
'fileSize:10240', // 文件大小不超过10M (10 * 1024 KB) 'fileSize:10240000', // 文件大小不超过10M (10 * 1024 KB)
'fileExt:jpeg,jpg,png,gif', // 文件后缀只允许jpeg,png,jpg,gif 'fileExt:jpeg,jpg,png,gif', // 文件后缀只允许jpeg,png,jpg,gif
function ($value) { // function ($value) {
// 验证图片宽度在350 // // 验证图片宽度在350
list($width, $height) = getimagesize($value->getPathName()); // list($width, $height) = getimagesize($value->getPathName());
//
if ($width < 345 || $width > 355) { // if ($width < 345 || $width > 355) {
return '图片宽度不能小于345,且不能大于355像素'; // return '图片宽度不能小于345,且不能大于355像素';
} // }
if ($height < 145 || $height > 155) { // if ($height < 145 || $height > 155) {
return '图片高度不能小于145,且不能大于155像素'; // return '图片高度不能小于145,且不能大于155像素';
} // }
return true; // return true;
} // }
] ]
]; ];
validate($rule)->check($file); validate($rule)->check($file);

Loading…
Cancel
Save