Display image in an email based on a database value

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
jswright61
Forum Newbie
Posts: 1
Joined: Fri Jan 16, 2009 1:33 pm

Display image in an email based on a database value

Post 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
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

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

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

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

Post 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.
Post Reply