I would like to include Gravatar profile pictures in the newsletter that I am sending. I know that I can't just add a URL to the Gravatar-service with a URL as parameter but need to do some hashing first.
I do have a PHP enabled web site that I could use to "translate" the email to MD5 hash and perhaps return the complete image URL to be used in the newsletter, but I don't know how.
If I do it like this, then all I get is printed the URL on the webpage :
$email = "someone@somewhere.com";
$default = "http://www.mywebsite.com/homestar.jpg";
$size = 40;
$grav_url = "http://www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . "?d=" . urlencode( $default ) . "&s=" . $size;
echo $grav_url;
How can I "return" the complete URL so that I in the newsletter can write something like:
<img src="http://www.mywebsite.com/my-php-script.php?email=someemail@domain.com">`
(BTW I will of course dynamically insert the email like this in the newsletter:
http://www.mywebsite.dk/my-php-script.php?=[DYNAMICFIELD_EMAIL]` )
Perhaps some redirect of sorts?
Or if this will not work, can I instead have the script return the actual image?