[英]PHP - GetImageSize()
I'm trying to use the getimagesize()
function on an image uploading script. 我正在尝试在图像上传脚本上使用
getimagesize()
函数。 Sometimes, on certain images, I get an error. 有时,在某些图像上,我会出错。 So I tried to investigate.
所以我试图调查。
I used an image which seems to work, edited it with paint.exe, and saved it as a new jpg image. 我使用了似乎有效的图像,使用paint.exe对其进行了编辑,然后将其另存为新的jpg图像。
When I look at the $_FILES[]
, I get this : 当我看
$_FILES[]
,我得到了:
Original : 原版的 :
$_FILES : array(2) {
["thumb_a_uploader"]=> array(5) {
["name"]=> string(8) "1212.jpg"
["type"]=> string(10) "image/jpeg"
["tmp_name"]=> string(14) "/tmp/phprZ2H8G"
["error"]=> int(0)
["size"]=> int(90281)
}
Edited : 编辑:
$_FILES : array(2) {
["thumb_a_uploader"]=> array(5) {
["name"]=> string(16) "1212 - Copy.jpg"
["type"]=> string(0) ""
["tmp_name"]=> string(0) ""
["error"]=> int(2)
["size"]=> int(0)
}
And for the edited one, the imagetype was wiped. 对于已编辑的图像,图像类型被擦除。 I have the same problem with a picture taken with a smartphone.
使用智能手机拍摄的照片我也有同样的问题。
Any ideas ? 有任何想法吗 ?
You need to pay attention to ["error"]
. 您需要注意
["error"]
。
["error"]=>
int(2)
UPLOAD_ERR_FORM_SIZE
Value:
2
;值:
2
; The uploaded file exceeds theMAX_FILE_SIZE
directive that was specified in the HTML form.上载的文件超出了HTML表单中指定的
MAX_FILE_SIZE
指令。
Learn more about php file-upload.errors 了解有关php file-upload.errors的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.