Ciao a tutti!
Avrei bisogno di ricavare, da un file immagine passato da un form, altezza-larghezza-tipo.
Ho trovato in internet info su getimagesize, ma quando lo provo dandogli il nome e il percorso del file (es. immagini/picopallino.gif) mi da tutte le info precise... quando provo a passargli l'immagine da un form, mi da questo tipo di errore:
Warning: getimagesize() expects parameter 1 to be string, array given in C:\xampp\htdocs\iken\cms\test\get_size.php on line 14
Il codice del forum è questo
Codice PHP:
<form action="get_size.php" method="POST" enctype="multipart/form-data" name="offerta" id="offerta">
<table border="0">
<tr>
<td colspan="2" valign="top"><h2>Inserisci una nuova immagine</h2></td>
</tr>
<tr>
<td valign="top">Immagine</td>
<td valign="top"><input type="file" name="imgUp" id="imgUp" /></td>
</tr>
<tr>
<td colspan="2" valign="top">
<input type="hidden" name="CONTROL" id="CONTROL" value="OK" />
<input type="submit" name="Salva" id="Salva" value="Salva" />
</td>
</tr>
</table>
</form>
quello della pagina get_size.php è questo
Codice PHP:
<?php
if ((isset($_POST["CONTROL"])) && ($_POST["CONTROL"] == "OK")) {
$file = $_FILES["imgUp"];
if($file["name"] != ""){
list($width, $height, $type, $attr) = getimagesize($file);
echo "Image width " .$width;
echo "
";
echo "Image height " .$height;
echo "
";
echo "Image type " .$type;
echo "
";
echo "Attribute " .$attr;
}else{
echo "Errore";
}
}
?>
La linea 14 è questa:
list($width, $height, $type, $attr) = getimagesize($file);
Potete aiutarmi a capire dove sbaglio?