Author: weaverryan
Date: 2010-01-19 02:58:02 +0100 (Tue, 19 Jan 2010)
New Revision: 26861

Modified:
   plugins/sfSympalPlugin/trunk/config/app.yml
   plugins/sfSympalPlugin/trunk/lib/helper/SympalHelper.php
Log:
Adding configurability of the default gravatar image via app.yml


Modified: plugins/sfSympalPlugin/trunk/config/app.yml
===================================================================
--- plugins/sfSympalPlugin/trunk/config/app.yml 2010-01-19 01:25:33 UTC (rev 
26860)
+++ plugins/sfSympalPlugin/trunk/config/app.yml 2010-01-19 01:58:02 UTC (rev 
26861)
@@ -259,6 +259,8 @@
     # Configure recaptcha from sfFormExtraPlugin
     recaptcha_public_key: 6Ld2DgQAAAAAAApXLteupHPcbSxbSHkhNTuYLChX
     recaptcha_private_key: 6Ld2DgQAAAAAANIbaXJsFEBOyg56CL_ljy3APlPb
+    
+    gravatar_default_image: "/sfSympalPlugin/images/symfony_button.gif"
 
     # Configure the available languages
     language_codes: [en, fr, es]

Modified: plugins/sfSympalPlugin/trunk/lib/helper/SympalHelper.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/helper/SympalHelper.php    2010-01-19 
01:25:33 UTC (rev 26860)
+++ plugins/sfSympalPlugin/trunk/lib/helper/SympalHelper.php    2010-01-19 
01:58:02 UTC (rev 26861)
@@ -129,10 +129,18 @@
   return implode(' ', $icons);
 }
 
+/**
+ * Returns the url to a gravatar image based on the given email address
+ * 
+ * @param string $emailAddress The email address to lookup in gravatar
+ * @param string The size of the image to return
+ */
 function get_gravatar_url($emailAddress, $size = 40)
 {
-  $default = "http://www.somewhere.com/homestar.jpg";;
+  $default = sfSympalConfig::get('gravatar_default_image');
+  $default = image_path($default, true);
 
   $url = 
'http://www.gravatar.com/avatar.php?gravatar_id='.md5(strtolower($emailAddress)).'&default='.urlencode($default).'&size='.$size;
+  
   return $url;
 }
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to