mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Use correct image sizes in various templates
This commit is contained in:
parent
608c34815e
commit
ed9dac2ac1
25 changed files with 38 additions and 37 deletions
|
@ -38,12 +38,12 @@ class Club extends RowModel
|
|||
return iterator_to_array($avPhotos)[0] ?? NULL;
|
||||
}
|
||||
|
||||
function getAvatarUrl(): string
|
||||
function getAvatarUrl(string $size = "miniscule"): string
|
||||
{
|
||||
$serverUrl = ovk_scheme(true) . $_SERVER["HTTP_HOST"];
|
||||
$avPhoto = $this->getAvatarPhoto();
|
||||
|
||||
return is_null($avPhoto) ? "$serverUrl/assets/packages/static/openvk/img/camera_200.png" : $avPhoto->getURL();
|
||||
return is_null($avPhoto) ? "$serverUrl/assets/packages/static/openvk/img/camera_200.png" : $avPhoto->getURLBySizeId($size);
|
||||
}
|
||||
|
||||
function getAvatarLink(): string
|
||||
|
|
|
@ -26,6 +26,7 @@ class Photo extends Media
|
|||
if(($image->getWidth() / $image->getHeight()) > ($px / $py)) {
|
||||
# For some weird reason using resize with EXACT flag causes system to consume an unholy amount of RAM
|
||||
$image->crop(0, 0, "100%", (int) ceil(($px * $image->getWidth()) / $py));
|
||||
$res[0] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ class User extends RowModel
|
|||
return "/id" . $this->getId();
|
||||
}
|
||||
|
||||
function getAvatarUrl(): string
|
||||
function getAvatarUrl(string $size = "miniscule"): string
|
||||
{
|
||||
$serverUrl = ovk_scheme(true) . $_SERVER["HTTP_HOST"];
|
||||
|
||||
|
@ -115,7 +115,7 @@ class User extends RowModel
|
|||
if(is_null($avPhoto))
|
||||
return "$serverUrl/assets/packages/static/openvk/img/camera_200.png";
|
||||
else
|
||||
return $avPhoto->getURL();
|
||||
return $avPhoto->getURLBySizeId($size);
|
||||
}
|
||||
|
||||
function getAvatarLink(): string
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
</label>
|
||||
<span id="avatar" class="aui-avatar aui-avatar-project aui-avatar-xlarge">
|
||||
<span class="aui-avatar-inner">
|
||||
<img src="{$club->getAvatarUrl()}" style="object-fit: cover;"></img>
|
||||
<img src="{$club->getAvatarUrl('tiny')}" style="object-fit: cover;"></img>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -155,7 +155,7 @@
|
|||
<td>
|
||||
<span class="aui-avatar aui-avatar-xsmall">
|
||||
<span class="aui-avatar-inner">
|
||||
<img src="{$follower->getAvatarUrl()}" alt="{$follower->getCanonicalName()}" role="presentation" />
|
||||
<img src="{$follower->getAvatarUrl('miniscule')}" alt="{$follower->getCanonicalName()}" role="presentation" />
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
@ -188,4 +188,4 @@
|
|||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
{/block}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<td>
|
||||
<span class="aui-avatar aui-avatar-xsmall">
|
||||
<span class="aui-avatar-inner">
|
||||
<img src="{$club->getAvatarUrl()}" alt="{$club->getCanonicalName()}" style="object-fit: cover;" role="presentation" />
|
||||
<img src="{$club->getAvatarUrl('miniscule')}" alt="{$club->getCanonicalName()}" style="object-fit: cover;" role="presentation" />
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
<span class="aui-avatar aui-avatar-xsmall">
|
||||
<span class="aui-avatar-inner">
|
||||
<img src="{$user->getAvatarUrl()}" alt="{$user->getCanonicalName()}" role="presentation" />
|
||||
<img src="{$user->getAvatarUrl('miniscule')}" alt="{$user->getCanonicalName()}" role="presentation" />
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</label>
|
||||
<span id="avatar" class="aui-avatar aui-avatar-project aui-avatar-xlarge">
|
||||
<span class="aui-avatar-inner">
|
||||
<img src="{$user->getAvatarUrl()}" style="object-fit: cover;"></img>
|
||||
<img src="{$user->getAvatarUrl('tiny')}" style="object-fit: cover;"></img>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<td>
|
||||
<span class="aui-avatar aui-avatar-xsmall">
|
||||
<span class="aui-avatar-inner">
|
||||
<img src="{$user->getAvatarUrl()}" alt="{$user->getCanonicalName()}" style="object-fit: cover;" role="presentation" />
|
||||
<img src="{$user->getAvatarUrl('miniscule')}" alt="{$user->getCanonicalName()}" style="object-fit: cover;" role="presentation" />
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<td>
|
||||
<span class="aui-avatar aui-avatar-xsmall">
|
||||
<span class="aui-avatar-inner">
|
||||
<img src="{$user->getAvatarUrl()}" alt="{$user->getCanonicalName()}" role="presentation" />
|
||||
<img src="{$user->getAvatarUrl('miniscule')}" alt="{$user->getCanonicalName()}" role="presentation" />
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
{/block}
|
||||
|
||||
{block preview}
|
||||
<img src="{$x instanceof $Manager ? $x->getUser()->getAvatarURL() : $x->getAvatarURL()}" alt="{$x instanceof $Manager ? $x->getUser()->getCanonicalName() : $x->getCanonicalName()}" width=75 />
|
||||
<img src="{$x instanceof $Manager ? $x->getUser()->getAvatarURL() : $x->getAvatarURL('miniscule')}" alt="{$x instanceof $Manager ? $x->getUser()->getCanonicalName() : $x->getCanonicalName()}" width=75 />
|
||||
{/block}
|
||||
|
||||
{block name}
|
||||
|
@ -140,4 +140,4 @@
|
|||
</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{/block}
|
||||
{/block}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<div class="cl_element" n:foreach="$club->getFollowers(1) as $follower">
|
||||
<div class="cl_avatar">
|
||||
<a href="{$follower->getURL()}">
|
||||
<img class="ava" src="{$follower->getAvatarUrl()}" />
|
||||
<img class="ava" src="{$follower->getAvatarUrl('miniscule')}" />
|
||||
</a>
|
||||
</div>
|
||||
<a href="{$follower->getURL()}" class="cl_name">
|
||||
|
@ -94,7 +94,7 @@
|
|||
{var avatarPhoto = $club->getAvatarPhoto()}
|
||||
{var avatarLink = ((is_null($avatarPhoto) ? FALSE : $avatarPhoto->isAnonymous()) ? "/photo" . ("s/" . base_convert((string) $avatarPhoto->getId(), 10, 32)) : $club->getAvatarLink())}
|
||||
<a href="{$avatarLink|nocheck}">
|
||||
<img src="{$club->getAvatarUrl()}" style="width: 100%; image-rendering: -webkit-optimize-contrast;" />
|
||||
<img src="{$club->getAvatarUrl('normal')}" style="width: 100%; image-rendering: -webkit-optimize-contrast;" />
|
||||
</a>
|
||||
<div n:ifset="$thisUser" id="profile_links">
|
||||
{if $club->canBeModifiedBy($thisUser)}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
</div>
|
||||
<div class="messenger-app--input">
|
||||
{if $correspondent->getId() === $thisUser->getId() || $correspondent->getPrivacyPermission('messages.write', $thisUser)}
|
||||
<img class="ava" src="{$thisUser->getAvatarUrl()}" alt="{$thisUser->getCanonicalName()}" />
|
||||
<img class="ava" src="{$thisUser->getAvatarUrl('miniscule')}" alt="{$thisUser->getCanonicalName()}" />
|
||||
<div class="messenger-app--input---messagebox">
|
||||
<textarea
|
||||
data-bind="value: messageContent, event: { keydown: onTextareaKeyPress }"
|
||||
|
@ -52,7 +52,7 @@
|
|||
placeholder="Введите сообщение"></textarea>
|
||||
<button class="button" data-bind="click: sendMessage">Отправить</button>
|
||||
</div>
|
||||
<img class="ava" src="{$correspondent->getAvatarUrl()}" alt="{$correspondent->getCanonicalName()}" />
|
||||
<img class="ava" src="{$correspondent->getAvatarUrl('miniscule')}" alt="{$correspondent->getCanonicalName()}" />
|
||||
{else}
|
||||
<div class="blocked" data-localized-text="Вы не можете писать сообщения {$correspondent->getCanonicalName()} из-за его настроек приватности."></div>
|
||||
{/if}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
{var lastMsg = $coresp->getPreviewMessage()}
|
||||
|
||||
<div class="crp-entry--image">
|
||||
<img src="{$recipient->getAvatarURL()}"
|
||||
<img src="{$recipient->getAvatarURL('miniscule')}"
|
||||
alt="Фотография пользователя" />
|
||||
</div>
|
||||
<div class="crp-entry--info">
|
||||
|
@ -36,7 +36,7 @@
|
|||
{var _author = $lastMsg->getSender()}
|
||||
|
||||
<div class="crp-entry--message---av" n:if="$_author->getId() === $thisUser->getId()">
|
||||
<img src="{$_author->getAvatarURL()}"
|
||||
<img src="{$_author->getAvatarURL('miniscule')}"
|
||||
alt="Фотография пользователя" />
|
||||
</div>
|
||||
<div class="crp-entry--message---text">
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<div n:foreach="$data as $dat">
|
||||
<div class="profile_thumb">
|
||||
<a href="{$owner->getURL()}">
|
||||
<img src="{$owner->getAvatarUrl()}" style="width: 50px;">
|
||||
<img src="{$owner->getAvatarUrl('miniscule')}" style="width: 50px;">
|
||||
</a>
|
||||
</div>
|
||||
<article class="note_body" id="userContent" style="width: 540px; display: inline-block; margin-bottom: 35px;">
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{/block}
|
||||
|
||||
{block preview}
|
||||
<img src="{$x->getModel(1)->getAvatarUrl()}" width=64 />
|
||||
<img src="{$x->getModel(1)->getAvatarUrl('miniscule')}" width=64 />
|
||||
{/block}
|
||||
|
||||
{block name}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
{block preview}
|
||||
{var cover = $x->getCoverPhoto()}
|
||||
{var preview = is_null($cover) ? "/assets/packages/static/openvk/img/camera_200.png" : $cover->getURL()}
|
||||
{var preview = is_null($cover) ? "/assets/packages/static/openvk/img/camera_200.png" : $cover->getURLBySizeId("normal")}
|
||||
|
||||
<a href="/album{$x->getPrettyId()}">
|
||||
<img src="{$preview}" alt="{$x->getName()}" style="height: 130px; width: 170px; object-fit: cover" />
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
{block content}
|
||||
<center style="margin-bottom: 8pt;">
|
||||
<img src="{$photo->getURL()}" style="max-width: 80%; max-height: 60vh;" />
|
||||
<img src="{$photo->getURLBySizeId('large')}" style="max-width: 80%; max-height: 60vh;" />
|
||||
</center>
|
||||
|
||||
<hr/>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
{/block}
|
||||
|
||||
{block preview}
|
||||
<img src="{$x->getAvatarUrl()}" width="75" alt="{_"photo"}" />
|
||||
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="{_"photo"}" />
|
||||
{/block}
|
||||
|
||||
{block name}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<tr>
|
||||
{if $comment->getUType() === 0}
|
||||
<td width="54" valign="top">
|
||||
<img src="{$comment->getUser()->getAvatarUrl()}" width="50" />
|
||||
<img src="{$comment->getUser()->getAvatarUrl('miniscule')}" width="50" />
|
||||
</td>
|
||||
{else}
|
||||
<td width="54" valign="top">
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<tr>
|
||||
{if $comment->getUType() === 0}
|
||||
<td width="54" valign="top">
|
||||
<img src="{$comment->getUser()->getAvatarUrl()}" width="50" />
|
||||
<img src="{$comment->getUser()->getAvatarUrl('miniscule')}" width="50" />
|
||||
</td>
|
||||
{else}
|
||||
<td width="54" valign="top">
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
{/block}
|
||||
|
||||
{block preview}
|
||||
<img src="{$x->getAvatarUrl()}" width="75" alt="Фотография группы" />
|
||||
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография пользователя" />
|
||||
{/block}
|
||||
|
||||
{block name}
|
||||
|
@ -145,4 +145,4 @@
|
|||
</form>
|
||||
{/if}
|
||||
{/if}
|
||||
{/block}
|
||||
{/block}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
{/block}
|
||||
|
||||
{block preview}
|
||||
<img src="{$x->getAvatarUrl()}" width="75" alt="Фотография группы" />
|
||||
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="Фотография группы" />
|
||||
{/block}
|
||||
|
||||
{block name}{/block}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<!-- openGraph -->
|
||||
<meta property="og:title" content="{$user->getCanonicalName()}" />
|
||||
<meta property="og:url" content="http://{$_SERVER['HTTP_HOST']}{$user->getURL()}" />
|
||||
<meta property="og:image" content="{$user->getAvatarUrl()}" />
|
||||
<meta property="og:image" content="{$user->getAvatarUrl('normal')}" />
|
||||
<meta property="og:type" content="profile" />
|
||||
<meta property="og:first_name" content="{$user->getFirstName()}" />
|
||||
<meta property="og:last_name" content="{$user->getLastName()}" />
|
||||
|
@ -62,7 +62,7 @@
|
|||
<div class="left_small_block">
|
||||
<div>
|
||||
<a href="{$user->getAvatarLink()|nocheck}">
|
||||
<img src="{$user->getAvatarUrl()}"
|
||||
<img src="{$user->getAvatarUrl('normal')}"
|
||||
alt="{$user->getCanonicalName()}"
|
||||
style="width: 100%; image-rendering: -webkit-optimize-contrast;" />
|
||||
</a>
|
||||
|
@ -190,7 +190,7 @@
|
|||
<div class="cl_element" n:foreach="$user->getFriends(1) as $friend">
|
||||
<div class="cl_avatar">
|
||||
<a href="{$friend->getURL()}">
|
||||
<img class="ava" src="{$friend->getAvatarUrl()}" />
|
||||
<img class="ava" src="{$friend->getAvatarUrl('miniscule')}" />
|
||||
</a>
|
||||
</div>
|
||||
<a href="{$friend->getURL()}" class="cl_name">
|
||||
|
@ -218,7 +218,7 @@
|
|||
{var cover = $album->getCoverPhoto()}
|
||||
|
||||
<img
|
||||
src="{is_null($cover)?'/assets/packages/static/openvk/img/camera_200.png':$cover->getURL()}"
|
||||
src="{is_null($cover)?'/assets/packages/static/openvk/img/camera_200.png':$cover->getURLBySizeId('small')}"
|
||||
style="max-width: 80px; max-height: 54pt;" />
|
||||
</div>
|
||||
<div style="overflow: hidden; overflow-wrap: break-word;">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<tr>
|
||||
<td width="30" valign="top">
|
||||
<a href="{$author->getURL()}">
|
||||
<img src="{$author->getAvatarURL()}" width="30" class="cCompactAvatars" />
|
||||
<img src="{$author->getAvatarURL('miniscule')}" width="30" class="cCompactAvatars" />
|
||||
</a>
|
||||
</td>
|
||||
<td width="100%" valign="top">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<tr>
|
||||
<td width="54" valign="top">
|
||||
<a href="{$author->getURL()}">
|
||||
<img src="{$author->getAvatarURL()}" width="{ifset $compact}25{else}50{/ifset}" {ifset $compact}class="cCompactAvatars"{/ifset} />
|
||||
<img src="{$author->getAvatarURL('miniscule')}" width="{ifset $compact}25{else}50{/ifset}" {ifset $compact}class="cCompactAvatars"{/ifset} />
|
||||
<span n:if="!$post->isPostedOnBehalfOfGroup() && !$compact && $author->isOnline()" class="post-online">{_online}</span>
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<tr>
|
||||
<td width="54" valign="top">
|
||||
<a href="{$author->getURL()}">
|
||||
<img src="{$author->getAvatarURL()}" width="50" />
|
||||
<img src="{$author->getAvatarURL('miniscule')}" width="50" />
|
||||
<span n:if="!$post->isPostedOnBehalfOfGroup() && !($compact ?? false) && $author->isOnline()" class="post-online">{_online}</span>
|
||||
</a>
|
||||
</td>
|
||||
|
|
Loading…
Reference in a new issue