Thread: Smileys

    #1
  1. No Profile Picture
    TheDuke
    Guest
    Devshed Newbie (0 - 499 posts)
    I'm running a php3/mysql driven site
    I update my site with an addnews form and that is working ok...
    but now i wanted to try to include images in my newspostings...
    so i add a form of text in which i just include basic : ) stuff and when they are displayed onscreen the : ) is automatically converted to <img src="images/smiley.gif"> or something similar...
    how can i do that ?

  2. #2
  3. No Profile Picture
    Ulf Wendel
    Guest
    Devshed Newbie (0 - 499 posts)
    The King says: use preg_replace, getImagesize.

    $image = "images/smiley.gif";
    $imagesize = getImagesize ( $image );
    $tag = sprintf("<img src="%s" %s", $image, $imagesize[3] );
    $text = preg_replace("/ /", $image, $text);

Similar Threads

  1. Please help with ereg_replace()!
    By thrended in forum PHP Development
    Replies: 6
    Last Post: February 16th, 2004, 07:17 PM
  2. Only having a certain amount of smileys per row
    By BenS in forum PHP Development
    Replies: 1
    Last Post: January 2nd, 2004, 02:44 PM
  3. Working with smileys (making a function?)
    By watco?! in forum PHP Development
    Replies: 5
    Last Post: April 16th, 2002, 07:20 PM
  4. Smileys
    By Chrille in forum PHP Development
    Replies: 2
    Last Post: February 13th, 2001, 10:18 AM

IMN logo majestic logo threadwatch logo seochat tools logo