Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2008
    Posts
    28
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Displaying height & width of image

    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



    PHP Code:
    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"


  • #2
    Regular Coder
    Join Date
    Mar 2009
    Location
    United Kingdom
    Posts
    161
    Thanks
    6
    Thanked 28 Times in 28 Posts
    Use this command to get the dimension of the image :

    PHP Code:
    list($width,$height) = getimagesize($image);

    echo 
    $width;
    echo 
    $height
    Hope this helps!

    Killermud

  • Users who have thanked Killermud for this post:

    Papajo (05-01-2009)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •