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 3 of 3

Thread: BBCode help

  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts

    BBCode help

    Hey,

    Just wondering if someone could help me write in a snippet of code which would make sure the link in between the [img] tags is infact an image.

    PHP Code:
      $search = array('/\[b\](.*?)\[\/b\]/is''/\[i\](.*?)\[\/i\]/is''/\[u\](.*?)\[\/u\]/is''/\[url\=(.*?)\](.*?)\[\/url\]/is''/\[center\](.*?)\[\/center\]/is''/\[img\](.*?)\[\/img\]/is');
        
    $replace = array('<b>$1</b>''<i>$1</i>''<u>$1</u>''<a href="$1" target="_blank">$2</a>''<center>$1</center>''<img src="$1" border="0">'); 
    How would i test to see if it was an image? I'm assuming i check the $1 variable, but how would i test to make sure they are using the [img] tag and not the [url] tag :X

    Any help would be appriciated

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    One way is to run the image through getimagesize().

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks. How would i know they are using [img] code tags though :X


  •  

    Posting Permissions

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