PHP dimensione immagine
Domanda
Come ottenere la larghezza e l'altezza di un'immagine?
Ho $variable = 'http://site.com/image.png"
Vuoi ottenere la larghezza di questa immagine per $width
e l'altezza a $height
.
Come:
$variable = 'http://site.com/image.png"
$width = '300'; // image width is 300px
$height = '500'; // height is 500px
Grazie.
Soluzione
$variable = 'http://site.com/image.png';
$image = getimagesize($variable);
$width = $image[0];
$height = $image[1];
$type = $image[2];
Altri suggerimenti
getimagesize funzione. Forse vi aiuterà.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow