Graphical smilie in textarea

They have: 5 posts

Joined: May 2009

How would I go about to insert a graphical smilie? That is, not just a : ) or : D etc., but the real image? I couldn't find anything on Google, except "it can't be done cause an textarea cant have elements within itself", but it's clearly possible since you can do it in this textarea, like so

Thanks

He has: 629 posts

Joined: May 2007

Someone wiped the smile from your interface!

They have: 10 posts

Joined: May 2009

What you want for example: I love Aishwarya, do u want a love sign in place of Aiswarya??? This can be done but not in a text area. Get the texts in seperate arrays of strings. Then use something like this
I Aishwarya.

Or if u are coding

Then str[0]++str[1];

This should do if u are doing a web application. In windows applications you will have to use a picture box to show that bitmap within the Text.

They have: 83 posts

Joined: Apr 2009

A TEXTAREA can only hold text. Any HTML or other code put into that one will be shown as text only. however, This can be done with WYSIWYG editors.

greg's picture

He has: 1,581 posts

Joined: Nov 2005

buddhi225 wrote:
"it can't be done cause an textarea cant have elements within itself", but it's clearly possible since you can do it in this textarea
The textareas here don't show smilies, they show the text only. It's only when the post shows in the thread or the preview that the graphical image for specific text is shown.

So you could do this when displaying the text.

So in a text area input I would type That was fun : D and it would save the text in the DB exactly like that.
Then when outputting you would convert specific characters to an image.
EG
: D = <img src="grin.jpg">

So when the page displays the post, or even a preview like this site allows, the text will actually show an image. But the text put in a textarea will show the text, again like this site does.

That's just the basic idea of course, just ask if you need someone to give some ideas of the PHP (etc) code to actually do this.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.