gpt4 book ai didi

php - 获取图片高宽PHP

转载 作者:可可西里 更新时间:2023-10-31 22:07:50 26 4
gpt4 key购买 nike

您好,我需要动态获取上传图片的高度和宽度。

这是我正在使用的 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, $height, $type, $attr) = getimagesize($_FILES["Artwork"]['tmp_name']);

参见 http://www.php.net/manual/en/features.file-upload.post-method.php

关于php - 获取图片高宽PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7570831/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com