add channel avatar
This commit is contained in:
@@ -415,6 +415,36 @@ img {
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
margin-bottom: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.channel-avatar {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
margin-right: 8px;
|
||||
object-fit: cover;
|
||||
flex-shrink: 0;
|
||||
border: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.channel-avatar-placeholder {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
margin-right: 8px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #e5e5e5;
|
||||
color: #666;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@@ -275,6 +275,11 @@ function formatVideosData($videosData) {
|
||||
? PEERTUBE_URL . $video['previewPath']
|
||||
: 'img/default-thumbnail.jpg';
|
||||
|
||||
// Récupérer l'avatar de la chaîne
|
||||
$channelAvatar = isset($video['channel']['avatars'][0]['path']) && isset($video['channel']['avatars'][0]['path'])
|
||||
? PEERTUBE_URL . $video['channel']['avatars'][0]['path']
|
||||
: 'img/default-avatar.png';
|
||||
|
||||
// Formater les données
|
||||
$videos[] = [
|
||||
'id' => $video['uuid'],
|
||||
@@ -282,6 +287,7 @@ function formatVideosData($videosData) {
|
||||
'thumbnail' => $thumbnail,
|
||||
'duration' => $video['duration'],
|
||||
'channel' => $video['channel']['displayName'],
|
||||
'channelAvatar' => $channelAvatar,
|
||||
'views' => $video['views'],
|
||||
'date' => $video['publishedAt'],
|
||||
'aspectRatio' => $video['aspectRatio'],
|
||||
|
||||
@@ -218,7 +218,16 @@
|
||||
</div>
|
||||
<div class="video-info">
|
||||
<h3 class="video-title"><?php echo $video['title']; ?></h3>
|
||||
<div class="video-channel"><?php echo $video['channel']; ?></div>
|
||||
<div class="video-channel">
|
||||
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== false || empty($video['channelAvatar'])): ?>
|
||||
<div class="channel-avatar-placeholder">
|
||||
<i class="fas fa-user-circle"></i>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<img src="<?php echo $video['channelAvatar']; ?>" alt="<?php echo $video['channel']; ?>" class="channel-avatar">
|
||||
<?php endif; ?>
|
||||
<span class="channel-name"><?php echo $video['channel']; ?></span>
|
||||
</div>
|
||||
<div class="video-metadata">
|
||||
<span class="video-views"><i class="fas fa-eye"></i> <?php echo formatViewCount($video['views']); ?> vues</span>
|
||||
<span class="video-date"><i class="far fa-calendar-alt"></i> <?php echo formatDate($video['date']); ?></span>
|
||||
@@ -264,7 +273,16 @@
|
||||
</div>
|
||||
<div class="video-info">
|
||||
<h3 class="video-title"><?php echo $video['title']; ?></h3>
|
||||
<div class="video-channel"><?php echo $video['channel']; ?></div>
|
||||
<div class="video-channel">
|
||||
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== false || empty($video['channelAvatar'])): ?>
|
||||
<div class="channel-avatar-placeholder">
|
||||
<i class="fas fa-user-circle"></i>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<img src="<?php echo $video['channelAvatar']; ?>" alt="<?php echo $video['channel']; ?>" class="channel-avatar">
|
||||
<?php endif; ?>
|
||||
<span class="channel-name"><?php echo $video['channel']; ?></span>
|
||||
</div>
|
||||
<div class="video-metadata">
|
||||
<span class="video-views"><i class="fas fa-eye"></i> <?php echo formatViewCount($video['views']); ?> vues</span>
|
||||
<span class="video-date"><i class="far fa-calendar-alt"></i> <?php echo formatDate($video['date']); ?></span>
|
||||
@@ -310,7 +328,16 @@
|
||||
</div>
|
||||
<div class="video-info">
|
||||
<h3 class="video-title"><?php echo $video['title']; ?></h3>
|
||||
<div class="video-channel"><?php echo $video['channel']; ?></div>
|
||||
<div class="video-channel">
|
||||
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== false || empty($video['channelAvatar'])): ?>
|
||||
<div class="channel-avatar-placeholder">
|
||||
<i class="fas fa-user-circle"></i>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<img src="<?php echo $video['channelAvatar']; ?>" alt="<?php echo $video['channel']; ?>" class="channel-avatar">
|
||||
<?php endif; ?>
|
||||
<span class="channel-name"><?php echo $video['channel']; ?></span>
|
||||
</div>
|
||||
<div class="video-metadata">
|
||||
<span class="video-views"><i class="fas fa-eye"></i> <?php echo formatViewCount($video['views']); ?> vues</span>
|
||||
<span class="video-date"><i class="far fa-calendar-alt"></i> <?php echo formatDate($video['date']); ?></span>
|
||||
|
||||
Reference in New Issue
Block a user