Pony.fm/app/library/Gravatar.php

26 lines
612 B
PHP
Raw Normal View History

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 {
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 ) ) );
$url .= "?s=$size&r=$rating";
2013-09-01 22:04:30 +02:00
if ($default != null)
$url .= "&d=" . $default;
else {
2013-09-01 22:04:30 +02:00
$size = 'normal';
if ($size == 50)
2013-09-01 22:04:30 +02:00
$size = 'thumbnail';
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;
}
}