Преглед на файлове

Merge pull request #151 from hellcp/patch-6

Make user images square and not dependant on aspect ratio
daniel преди 7 години
родител
ревизия
fb3c45943f
променени са 2 файла, в които са добавени 28 реда и са изтрити 6 реда
  1. 20 0
      resources/assets/sass/custom.scss
  2. 8 6
      resources/views/profile/show.blade.php

+ 20 - 0
resources/assets/sass/custom.scss

@@ -153,3 +153,23 @@ body, button, input, textarea {
 .font-weight-ultralight {
     font-weight: 200 !important;
 }
+
+.square {
+    position: relative;
+    width: 100%;
+}
+
+.square::after {
+    content: "";
+    display: block;
+    padding-bottom: 100%;
+}
+
+.square-content {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    background-repeat: no-repeat;
+    background-size: cover;
+    background-position: 50%;
+}

+ 8 - 6
resources/views/profile/show.blade.php

@@ -101,12 +101,14 @@
       @foreach($timeline as $status)
       <div class="col-12 col-md-4 mb-4">
         <a class="card info-overlay" href="{{$status->url()}}">
-          <img class="card-img-top" src="{{$status->thumb()}}" width="300px" height="300px">
-          <div class="info-overlay-text">
-            <h5 class="text-white m-auto">
-              <span class="icon-heart">{{$item->likes()->count()}}</span>
-              <span class="icon-speech">{{$item->comments()->count()}}</span>
-            </h5>
+          <div class="square">
+            <div class="square-content" style="background-image: url('{{$status->thumb()}}')"></div>
+            <div class="info-overlay-text">
+              <h5 class="text-white m-auto">
+                <span class="icon-heart">{{$item->likes()->count()}}</span>
+                <span class="icon-speech">{{$item->comments()->count()}}</span>
+              </h5>
+            </div>
           </div>
         </a>
       </div>