您好,我需要获取已上传图片的高度和宽度。获取图片的高度和宽度PHP
这是我使用的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>';
}
'getimagesize()'是票。你只是没有使用正确的变量作为参数。应该有这样的错误消息:激活错误报告以查看它。 –
[获取图像高度和宽度作为整数值?]可能重复(http://stackoverflow.com/questions/2179100/get-image-height-and-width-as-integer-values) –