PHP - GetImageSize()
PHP - GetImageSize()
我正在尝试在图像上传脚本中使用 getimagesize()
函数。
有时,在某些图像上,我会出错。
所以我试着去调查一下。
我使用了一张看起来可行的图片,用 paint.exe 对其进行了编辑,并将其另存为新的 jpg 图片。
当我查看 $_FILES[]
时,我得到了这个:
原文:
$_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)
}
已编辑:
$_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)
}
对于编辑过的图像,图像类型已被擦除。
我用智能手机拍的照片也有同样的问题。
有什么想法吗?
您需要关注["error"]
。
["error"]=>
int(2)
UPLOAD_ERR_FORM_SIZE
Value: 2
; The uploaded file exceeds the MAX_FILE_SIZE
directive that
was specified in the HTML form.
我正在尝试在图像上传脚本中使用 getimagesize()
函数。
有时,在某些图像上,我会出错。
所以我试着去调查一下。
我使用了一张看起来可行的图片,用 paint.exe 对其进行了编辑,并将其另存为新的 jpg 图片。
当我查看 $_FILES[]
时,我得到了这个:
原文:
$_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)
}
已编辑:
$_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)
}
对于编辑过的图像,图像类型已被擦除。 我用智能手机拍的照片也有同样的问题。
有什么想法吗?
您需要关注["error"]
。
["error"]=>
int(2)
UPLOAD_ERR_FORM_SIZE
Value:
2
; The uploaded file exceeds theMAX_FILE_SIZE
directive that was specified in the HTML form.