Page 1 of 1

Display image in an email based on a database value

Posted: Fri Jan 16, 2009 1:55 pm
by jswright61
I have a system that sends an alert via email to various team members when a voicemail message is left. What I would like to do is put an image link in the email that points to an image on my webserver. The webserver, when it gets a request for the image, will check a database and send an image back based on the status of the voicemail.

so the email that goes out will have an image in it:
<img src="http://example.com/images/dynamic/msg_000001.jpg" width="149" height="168">

The webserver (apache) would take the image request and instead of just serving the image, it would parse the numeric portion of the image name and query a database based on that value, determine the status from the database and then serve back an image based on the status. Is this possible, and if so, how would I do it?

Thanks in advance

Scott

Re: Display image in an email based on a database value

Posted: Fri Jan 16, 2009 5:35 pm
by Burrito
the best thing to do would be to set up an application mapping for .jpgs in an .htaccess that would have php parse the file of type .jpg as a php page and send down whatever image it needs to accordingly.

then you could do <img src="http://www.myserver.com/myprotectedfold ... omeparam=1"> and depending on what someparam is, query the db and send the appropriate image down.

Re: Display image in an email based on a database value

Posted: Sat Jan 17, 2009 9:34 pm
by Chris Corbyn
Note that this will be blocked by most mail clients by default for privacy reasons. This technique is used to harvest email addresses.