1

I need to create a php script that renders an image... no problem.

However, what i'd like to do is have the image rendering script trigger some javascript code whenever the script is started up.

Is it possible to include javascript code within the image generating php script without it screwing up the image?

1
  • 1
    No. Javascript runs on the client, and images cannot contain Javascript. Commented Sep 9, 2013 at 21:19

1 Answer 1

2

Even if you add some javascript code into the image the browser will not run it.

Sign up to request clarification or add additional context in comments.

7 Comments

Is there a way to send a request to a second page when the image is called?
You can attach onload handler to the image tag to see when the image is loaded.
The image being generated will be going into an email... So i can't put an onload to the img tag :(
@Brds: You can't run JS in emails, period.
Right, I was trying to run JS in the script that generates the image used in the email, not in the email itself. I'm wondering if maybe a header() call in the script might do the job.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.