/    Sign up×
Community /Pin to ProfileBookmark

Insert Image Code

I have a page with a textarea and some images. I want to know if there is a php script which will allow the visitor to click on the image and then a special code would be inserted into the textarea and then when you hit submit the script would see that the special code means to insert a image so then instead of outputting the code it would output the image that the code is linked to. Kinda how the smilies work on this forum but it would have to be php so not just javascript enabled visitors could use it! Thanks for any help anybody can provide.?

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@JickauthorFeb 18.2004 — I have figured out the first part of this request. I can make the script change the code from the code to the image. I now only need the part about clicking on the image to insert it into the textarea. Once again thank you for any help. ?
Copy linkTweet thisAlerts:
@JickauthorFeb 18.2004 — Ok, I know it is possible to do it with JavaScript but I don't want to have to use it cause then like most of my visitors won't be able to use it! Is there a way to do this in php or another language which is viewable by all visitors? I will apreciate any help. ?
Copy linkTweet thisAlerts:
@JickauthorFeb 19.2004 — This is currently what I have:
<script type="text/javascript">
function smilies(thesmilie) {
document.shout.message.value += thesmilie+'';
document.shout.message.focus();
}
</script>

And this is the other part:
<a href="javascript:smilies(': )')"><img src="smile.gif" style="border: 0px;"></a>
I want to do this in php. Is it possible? Thanks. ?
Copy linkTweet thisAlerts:
@Paul_JrFeb 19.2004 — I don't believe so - not unless you want the whole page reloading every time someone clicks on a smiley to insert. Since PHP runs ServerSide, it's already been processed by the time the page loads. This forum uses JS to insert smiles and such into the textarea; I think that's the way you'll have to go.
Copy linkTweet thisAlerts:
@JickauthorFeb 19.2004 — Well I'm willing to have the page refresh because this function has to work will all my visitors and doing it with javascript will disable it for some. Maybe it could be setup so the script checks if they have javascript enabled and if they do it will do the javascript version but if they don't then it will do it with php. I think that would be possible.
Copy linkTweet thisAlerts:
@Paul_JrFeb 19.2004 — Will the smiley appear if they just type in the text? Or does it have to come in via the image/button?
Copy linkTweet thisAlerts:
@JickauthorFeb 19.2004 — Yes they can type ": D" or something and it will make it the image.
Copy linkTweet thisAlerts:
@Paul_JrFeb 19.2004 — Hmmm... I dunno, I'd just stick with the JavaScript - having the page reload may annoy some users. ?

Pyro or someone may have a PHP script for you, but I'd suggest sticking with the JS.
×

Success!

Help @Jick spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...