¿Es posible ejecutar javascript en el script de representación de imágenes PHP?

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?

preguntado el 09 de septiembre de 13 a las 22:09

No. Javascript runs on the client, and images cannot contain Javascript. -

1 Respuestas

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

Respondido el 09 de Septiembre de 13 a las 22:09

Is there a way to send a request to a second page when the image is called? - Marcas

Puedes adjuntar onload handler to the image tag to see when the image is loaded. - Krasimir

The image being generated will be going into an email... So i can't put an onload to the img tag :( - Marcas

@Brds: You can't run JS in emails, período. - SLaks

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. - Marcas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.