获取图像高度和宽度PHP
发布时间:2020-12-13 17:28:43 所属栏目:PHP教程 来源:网络整理
导读:您好,我需要获取上传图像的高度和宽度. 这是我使用的PHP函数,但它不会返回任何宽度和高度.. 你可以帮我吗? list($width,$height,$type,$attr) = getimagesize($_FILES["Artwork"]);$min_width = "1000";$min_height = "1000";if ((($_FILES["Artwork"]["typ
您好,我需要获取上传图像的高度和宽度.
这是我使用的PHP函数,但它不会返回任何宽度和高度.. 你可以帮我吗? list($width,$height,$type,$attr) = getimagesize($_FILES["Artwork"]); $min_width = "1000"; $min_height = "1000"; if ((($_FILES["Artwork"]["type"] == "image/gif") || ($_FILES["Artwork"]["type"] == "image/jpeg") || ($_FILES["Artwork"]["type"] == "image/jpg") || ($_FILES["Artwork"]["type"] == "image/pjpeg")) && ($_FILES["Artwork"]["size"] < 20000000) && ($width > $min_width) && ($height > $min_height) && ($width == $height)) { if ($_FILES["Artwork"]["error"] > 0) { //echo "Return Code: " . $_FILES["Artwork"]["error"] . "<br />"; }else{ move_uploaded_file($_FILES["Artwork"]["tmp_name"],$path_image . $imageName); header("Location: http://pitchmystuff.co.uk/m/digidist/tracks/".$idAlbum.""); } }else{ //echo "invalid file"; echo '<script> alert("There was an error uploading your coverart file. Please check the requirements and try again.'.$width.$height.'"); document.location ="http://pitchmystuff.co.uk/m/digidist/albums/"; </script>'; }
应该
list($width,$attr) = getimagesize($_FILES["Artwork"]['tmp_name']); 见http://www.php.net/manual/en/features.file-upload.post-method.php (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容