diff --git a/app/Utilities/Formatter.php b/app/Utilities/Formatter.php index 0adee69..c936cd2 100644 --- a/app/Utilities/Formatter.php +++ b/app/Utilities/Formatter.php @@ -75,4 +75,21 @@ class Formatter return $url; } + + /** + * imgタグのsrcsetで使用できる形式で、プロフィール画像URLを生成します。 + * @param object $user Userなど、getProfileImageUrl()が実装されているオブジェクト + * @param int $baseSize 1x解像度における画像サイズ + * @param int $maxResolution 最大倍率 + * @return string srcset用の文字列 + */ + public function profileImageSrcSet($user, int $baseSize, int $maxResolution = 3) + { + $srcset = []; + for ($i = 1; $i <= $maxResolution; $i++) { + $srcset[] = $user->getProfileImageUrl($baseSize * $i) . " {$i}x"; + } + + return implode(',', $srcset); + } } diff --git a/resources/views/components/ejaculation.blade.php b/resources/views/components/ejaculation.blade.php index 9635273..3d17540 100644 --- a/resources/views/components/ejaculation.blade.php +++ b/resources/views/components/ejaculation.blade.php @@ -1,7 +1,7 @@
- {{ $ejaculation->user->display_name }} + {{ $ejaculation->user->display_name }} {{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}
@@ -39,7 +39,7 @@
@foreach ($ejaculation->likes as $like) @if ($like->user !== null) - + @endif @endforeach
diff --git a/resources/views/components/profile.blade.php b/resources/views/components/profile.blade.php index 676764f..253e187 100644 --- a/resources/views/components/profile.blade.php +++ b/resources/views/components/profile.blade.php @@ -1,6 +1,6 @@
- +

{{ $user->display_name }}

diff --git a/resources/views/ejaculation/show.blade.php b/resources/views/ejaculation/show.blade.php index 8d870e0..1f7d3d7 100644 --- a/resources/views/ejaculation/show.blade.php +++ b/resources/views/ejaculation/show.blade.php @@ -67,7 +67,7 @@ diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 5b0be88..0aceb12 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -10,7 +10,7 @@
- +
{{ Auth::user()->display_name }} diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.php index 201ee8d..786eaa3 100644 --- a/resources/views/layouts/base.blade.php +++ b/resources/views/layouts/base.blade.php @@ -40,7 +40,7 @@