...

View Full Version : Displaying height & width of image



Papajo
05-01-2009, 07:32 PM
Hi
I'm using this code to extract image links from a web page, I would like to display the height and width of each image also. Any help is appreciated. Thanks Joe





function hyperlinkextract($s1,$s2,$s){
$myarray=array();
$s1=strtolower($s1);
$s2=strtolower($s2);
$L1=strlen($s1);
$L2=strlen($s2);
$scheck=strtolower($s);
do{
$pos1 = strpos($scheck,$s1);
if($pos1!==false){
$pos2 = strpos(substr($scheck,$pos1+$L1),$s2);
if($pos2!==false){
$myarray[]=substr($s,$pos1+$L1,$pos2);
$s=substr($s,$pos1+$L1+$pos2+$L2);
$scheck=strtolower($s);
}
}
}
while (($pos1!==false)and($pos2!==false));
return $myarray;
}
$content = file_get_contents("$selected_file");
echo '<br /><b>filename: ' . $selected_file . '</b><hr>';
$myarray = hyperlinkextract("img src=\"","\"",$content);
foreach($myarray as $key => $val) {
echo "<br />".$val."\n";
}

Killermud
05-01-2009, 07:49 PM
Use this command to get the dimension of the image :


list($width,$height) = getimagesize($image);

echo $width;
echo $height;

Hope this helps!

Killermud



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum