2013-07-27 02:15:07 +02:00
|
|
|
<?php
|
|
|
|
|
2013-09-01 22:04:30 +02:00
|
|
|
use Illuminate\Support\Facades\Config;
|
|
|
|
use Illuminate\Support\Facades\URL;
|
|
|
|
|
2013-07-27 02:15:07 +02:00
|
|
|
class Gravatar {
|
2015-05-20 11:14:06 +02:00
|
|
|
public static function getUrl($email, $size = 80, $default = null, $rating = 'g') {
|
2013-09-01 11:55:59 +02:00
|
|
|
$url = 'https://www.gravatar.com/avatar/';
|
2013-07-27 02:15:07 +02:00
|
|
|
$url .= md5( strtolower( trim( $email ) ) );
|
2015-05-20 11:14:06 +02:00
|
|
|
$url .= "?s=$size&r=$rating";
|
2013-09-01 22:04:30 +02:00
|
|
|
|
2015-05-20 11:14:06 +02:00
|
|
|
if ($default != null)
|
|
|
|
$url .= "&d=" . $default;
|
|
|
|
else {
|
2013-09-01 22:04:30 +02:00
|
|
|
$size = 'normal';
|
2015-05-20 11:14:06 +02:00
|
|
|
if ($size == 50)
|
2013-09-01 22:04:30 +02:00
|
|
|
$size = 'thumbnail';
|
2015-05-20 11:14:06 +02:00
|
|
|
else if ($size == 100)
|
2013-09-01 22:04:30 +02:00
|
|
|
$size = 'small';
|
|
|
|
|
|
|
|
$url .= "&d=" . urlencode(URL::to('/images/icons/profile_' . $size . '.png'));
|
|
|
|
}
|
|
|
|
|
2013-07-27 02:15:07 +02:00
|
|
|
return $url;
|
|
|
|
}
|
|
|
|
}
|