- getimagesize: documentation ( source)
<?php
class Image
{
public $height;
public $width;
public $htmlAttribute;
}
$filename = "http://img.wikinut.com/img/gycf69_-6rv_5fol/jpeg/0/Best-Friends-Img-Src%3AImage%3A-FreeDigitalPhotos.net.jpeg";
$imgSize = getimagesize($filename) or die('Sorry, File Not Found');
if ($imgSize != "")
{
$img = new Image();
$img->height = $imgSize[0];
$img->width = $imgSize[1];
$img->htmlAttribute = $imgSize[3];
$counter = 0;
foreach ($imgSize as $imgProp)
{
echo $counter.":".PHP_EOL.$imgProp .PHP_EOL;
$counter += 1;
}
echo '<img src="'.$filename.'" />';
}