Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting smilies

Status
Not open for further replies.

PhoenixDown

Programmer
Jul 2, 2001
279
CA
I use this to convert ":)" and others into an image:

Code:
sub Smilies {

my $Smilie = shift;

$Smilie =~ s/\:\)/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/smile.gif&quot;>/isg;

$Smilie =~ s/\:\(/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/frown.gif&quot;>/isg;

$Smilie =~ s/\:D/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/biggrin.gif&quot;>/isg;

$Smilie =~ s/\&lt\;\)/\&lt\; \)/isg;

$Smilie =~ s/\&gt\;\)/\&gt\; \)/isg;

$Smilie =~ s/\;\)/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/wink.gif&quot;>/isg;

$Smilie =~ s/\:o/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/redface.gif&quot;>/isg;

$Smilie =~ s/\:eek:/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/eek.gif&quot;>/isg;

$Smilie =~ s/\:confused:/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/confused.gif&quot;>/isg;

$Smilie =~ s/\:mad:/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/mad.gif&quot;>/isg;

$Smilie =~ s/\:rolleyes:/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/rolleyes.gif&quot;>/isg;

$Smilie =~ s/\:cool:/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/cool.gif&quot;>/isg;

$Smilie =~ s/\:p/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/tongue.gif&quot;>/isg;

return ($Smilie);
}

How can I make this for my edit guestbook sub to convert images to &quot;:)&quot; or whatever the smilie is? :) - PLEASE GO THERE! WE NEED MORE MEMBERS! :)

-------------------

Sometimes when I go to the main page of tek-tips.com, I get:

HTTP Error 405
405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource identified by the request. Please ensure that you have the proper
 
Just reverse the process. Search for the image tag and replace it with the text.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Can you please do an example? I tried and it did not work. - PLEASE GO THERE! WE NEED MORE MEMBERS! :)

-------------------

Sometimes when I go to the main page of tek-tips.com, I get:

HTTP Error 405
405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource identified by the request. Please ensure that you have the proper
 
Is this what you tried? I don't know why it shouldn't work, since it's the exact opposite of what you did in the first place (all I did was cut-n-paste to swap the two sides of the substitute).
Code:
$Smilie =~ s/ <IMG SRC=&quot;$vars_gen{'NonCGIURL'}\/smilies\/smile.gif&quot;>/\:\)/isg;
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top