SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    custom [img] tag

    I've seen some examples of replacing [img] with its html equivalent posted here however I would like to take it a bit further. I was wondering if it would be possible to allow the user to specify width, height and alignment?

    I was thinking along the lines of the floowing for example:
    Code:
    [img=http://domain.com/test.jpg,30,10,right][/img]
    The problem is that a user might not enter the width, height and alignment all the time so it needs to determine whether or not they are present. I've messed around with it a bit but I can't get it to figure out if the advanced features are being used.

    Is this kind of thing possible? Any suggestion are appraciated

    Happy Holidays
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  2. #2
    SitePoint Zealot
    Join Date
    Oct 2001
    Location
    London, UK.
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made my custom image tag alignable (If that's a word!) by users.
    What they entered was something like so:

    [img=center]http://url.com/image.jpg[/img]

    Not too sure if you could use something like this:

    [img=40&60&right]http://url.com/image.jpg[/img]

    Where 40 is the width and 60 is the height.
    You'd need to explode the values out from the above.

    PHP Code:
    <?
    $txt 
    eregi_replace("\\[simg=([^\\[]*)\\]([^\\[]*)\\[/simg\\]","<img src=\"\\2\" align=\"\\1\" border=\"0\">",$txt);
    ?>
    ^^ is the code used for alignment. You may be able to play with this to make it work for what you need.

    David
    Do you fear the obselescence of the
    metanarrative apparatus of legitimation?


Bookmarks

Posting Permissions

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