Bonjour, j'ai besoin d'obtenir la hauteur et la largeur de la volée d'une image téléchargée.
Ceci est la fonction PHP que j'utilise, mais cela ne renvoie rien à la largeur et à la hauteur. P> Pourriez-vous m'aider s'il vous plaît? P>
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>';
}
4 Réponses :
devrait être voir http://www.php.net/manual/fr/features.file-upload.post-method.php p> p>
<?php
/*$size = getimagesize("http://heartbeatperformance.com.p9.hostingprod.com/customerphotos/photoes/51HDE3cnl2L.jpg");
list($width, $height) = $size;
echo "width: $width<br />height: $height";*/
$testing = "http://heartbeatperformance.com.p9.hostingprod.com/customerphotos/img/logo.png";
//echo $testing;
list($width, $height, $type, $attr) = getimagesize($testing);
echo "Image width " . $width;
echo "Image height " . $height;
?>
<?php $imagedetails = getimagesize($_FILES['Artwork']['tmp_name']); $width = $imagedetails[0]; $height = $imagedetails[1]; ?>
getImagesize () code> est le billet. Vous n'utilisez tout simplement pas la bonne variable comme paramètre. Il devrait y avoir un message d'erreur à cet effet: Activez la déclaration d'erreur pour le voir.Dupliquer possible de Obtenez la hauteur et la largeur de l'image en tant que valeurs entier?