added some things

This commit is contained in:
nelsonlaquet 2013-09-01 15:04:30 -05:00
parent 9e358a3fdc
commit 37bf25293d
21 changed files with 53 additions and 13 deletions

View file

@ -3,6 +3,7 @@
use Entities\Image;
use Entities\Track;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Redirect;
class ImagesController extends Controller {
public function getImage($id, $type) {
@ -18,6 +19,11 @@
$response = Response::make('', 200);
$filename = $image->getFile($coverType['id']);
if (!is_file($filename)) {
$redirect = URL::to('/images/icons/profile_' . Image::$ImageTypes[$coverType['id']]['name'] . '.png');
return Redirect::to($redirect);
}
if (Config::get('app.sendfile')) {
$response->header('X-Sendfile', $filename);
} else {

View file

@ -1,5 +1,8 @@
<?php
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL;
class Gravatar {
/**
 * Returns a Gravatar URL
@ -14,7 +17,18 @@
public static function getUrl( $email, $s = 80, $d = 'mm', $r = 'g') {
$url = 'https://www.gravatar.com/avatar/';
$url .= md5( strtolower( trim( $email ) ) );
$url .= "?s=$s&d=$d&r=$r";
$url .= "?s=$s&r=$r";
if (!Config::get('app.debug')) {
$size = 'normal';
if ($s == 50)
$size = 'thumbnail';
else if ($s == 100)
$size = 'small';
$url .= "&d=" . urlencode(URL::to('/images/icons/profile_' . $size . '.png'));
}
return $url;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,17 @@
angular.module('ponyfm').directive 'pfmSrcLoader', () ->
(scope, element, attrs) ->
size = attrs.pfmSrcSize || 'normal'
url = attrs.pfmSrcLoader
element.attr 'src', '/images/icons/loading_' + size + '.png'
image = element.clone()
image.removeAttr 'pfm-src-loader'
image.removeAttr 'pfm-src-size'
image[0].onload = ->
element.replaceWith image
image.css {opacity: 0}
image.animate {opacity: 1}, 250
image[0].src = url

3
public/template.php Normal file
View file

@ -0,0 +1,3 @@
<?php
echo 'template!';

View file

@ -12,7 +12,7 @@
<ul class="account-albums-listing stretch-to-bottom">
<li ng-repeat="album in albums" ng-class="{selected: album.id == data.selectedAlbum.id}">
<a href="/account/albums/edit/{{album.id}}">
<img class="image" ng-src="{{album.covers.normal}}" />
<img pfm-src-loader="{{album.covers.normal}}" pfm-src-size="normal" class="image" />
<span class="title">{{album.title}}</span>
<span class="published">{{album.created_at | pfmdate:'MM/dd/yyyy'}}</span>
</a>

View file

@ -22,7 +22,7 @@
<div class="stretch-to-bottom details-columns">
<div class="right">
<img class="cover" bo-src="album.covers.normal" />
<img class="cover" pfm-src-loader="{{album.covers.normal}}" pfm-src-size="normal" />
<div class="share-buttons" pfm-share-buttons>
<a class="tumblr" bo-href="album.share.tumblrUrl" title="Share on Tumblr" style="display:inline-block; overflow:hidden; width:20px; height:20px; background:url('/images/tumblr-share.png') top left no-repeat transparent;"></a>

View file

@ -2,8 +2,8 @@
<ul class="artist-listing">
<li ng-repeat="artist in artists" bindonce>
<a href="{{artist.url}}">
<img class="image" bo-src="artist.avatars.small" />
<span class="info">
<img class="image" pfm-src-loader="{{artist.avatars.small}}" pfm-src-size="small" />
<span class="info">
<span class="title" bo-text="artist.name"></span>
<span class="published">
joined <span bo-text="artist.created_at.date | momentFromNow"></span>

View file

@ -1,7 +1,7 @@
<ul class="albums-listing {{class}}">
<li ng-repeat="album in albums" bindonce>
<a bo-href="album.url">
<img class="image" bo-src="album.covers.small" />
<img class="image" pfm-src-loader="{{album.covers.small}}" pfm-src-size="small" />
<span class="info">
<span class="title" bo-text="album.title"></span>
<span class="published">

View file

@ -10,7 +10,7 @@
There are no comments yet!
</li>
<li bindonce ng-repeat="comment in resource.comments">
<img bo-src="comment.user.avatars.thumbnail" />
<img pfm-src-loader="{{comment.user.avatars.thumbnail}}" pfm-src-size="thumbnail" />
<div class="content">
<a bo-href="comment.user.url" bo-text="comment.user.name"></a>
<span bo-text="comment.content"></span>

View file

@ -22,7 +22,7 @@
</li>
</ul>
<div class="image">
<img ng-src="{{player.currentTrack.covers.thumbnail}}" />
<img pfm-src-loader="{{player.currentTrack.covers.thumbnail}}" pfm-src-size="thumbnail" />
</div>
<div class="inner">
<div class="title">

View file

@ -1,7 +1,7 @@
<ul class="playlists-listing {{class}}">
<li ng-repeat="playlist in playlists" bindonce>
<a href="{{playlist.url}}">
<img class="image" ng-src="{{playlist.covers.small}}"/>
<img class="image" pfm-src-loader="{{playlist.covers.small}}" pfm-src-size="small" />
<span class="info">
<span class="title">{{playlist.title}}</span>
<span class="published">

View file

@ -3,5 +3,5 @@
<i class="icon-play" ng-show="!track.isPlaying"></i>
<i class="icon-pause" ng-hide="!track.isPlaying"></i>
</a>
<img ng-src="{{track.covers.thumbnail}}" />
<img pfm-src-loader="{{track.covers.thumbnail}}" pfm-src-size="thumbnail" />
</div>

View file

@ -5,7 +5,7 @@
<i class="icon-play" ng-show="!track.isPlaying"></i>
<i class="icon-pause" ng-hide="!track.isPlaying"></i>
</a>
<img ng-src="{{track.covers.thumbnail}}" />
<img pfm-src-loader="{{track.covers.thumbnail}}" pfm-src-size="thumbnail" />
</div>
<div class="icons">
<span><i ng-class="{'icon-microphone-off': !track.is_vocal, 'icon-microphone': track.is_vocal}"></i></span>

View file

@ -21,7 +21,7 @@
<div class="stretch-to-bottom details-columns">
<div class="right">
<img class="cover" bo-src="playlist.covers.normal" />
<img class="cover" pfm-src-loader="{{playlist.covers.normal}}" pfm-src-size="normal" />
<div class="share-buttons" pfm-share-buttons>
<a class="tumblr" bo-href="playlist.share.tumblrUrl" title="Share on Tumblr" style="display:inline-block; overflow:hidden; width:20px; height:20px; background:url('/images/tumblr-share.png') top left no-repeat transparent;"></a>

View file

@ -41,7 +41,7 @@
<div class="stretch-to-bottom details-columns">
<div class="right">
<img class="cover" bo-src="track.covers.normal" />
<img class="cover" pfm-src-loader="{{track.covers.normal}}" pfm-src-size="normal" />
<div class="share-buttons" pfm-share-buttons>
<a class="tumblr" bo-href="track.share.tumblrUrl" title="Share on Tumblr" style="display:inline-block; overflow:hidden; width:20px; height:20px; background:url('/images/tumblr-share.png') top left no-repeat transparent;"></a>