diff --git a/public/css/admin.css b/public/css/admin.css index 92c2736..6be934e 100644 --- a/public/css/admin.css +++ b/public/css/admin.css @@ -1,21 +1,21 @@ /* Edit icon on tiled grids -----------------------------*/ -.tiled_grid div.landscape, .tiled_grid div.portrait, .tiled_grid div.panorama { +.polaroid { position: relative; } -.tiled_grid div > a.edit { +.polaroid a.edit { background: #fff; border-radius: 3px; box-shadow: 1px 1px 2px rgba(0,0,0,0.3); - display: none; + display: none !important; left: 20px; line-height: 1.5; padding: 5px 10px; position: absolute; top: 20px; } -.tiled_grid div:hover > a.edit { - display: block; +.polaroid:hover > a.edit { + display: block !important; } diff --git a/public/css/default.css b/public/css/default.css index a2df598..5fa1743 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -179,26 +179,25 @@ i.space-invader.alt-7::before { /* Album index ----------------*/ -.album-index { +.album-index, .photo-index { clear: both; } /* Tiled grid ---------------*/ -.tiled_header { +.tiled-header > a { background: #fff; box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); border-radius: 0.5rem; color: #000; - clear: both; - float: left; - margin: 0 0 1.5% 0; + display: inline-block; font: 400 18px/2.2 'Coda', sans-serif; + margin: 0 0 1.5% 0; + overflow: hidden; padding: 6px 22px; text-overflow: ellipsis; white-space: nowrap; - overflow: hidden; } .tiled_grid { diff --git a/templates/PhotosIndex.php b/templates/PhotosIndex.php index 29fa06a..ee6e8c2 100644 --- a/templates/PhotosIndex.php +++ b/templates/PhotosIndex.php @@ -45,7 +45,7 @@ class PhotosIndex extends Template public function html_main() { echo ' -
'; +
'; for ($i = $this->row_limit; $i > 0 && $row = $this->mosaic->getRow(); $i--) { @@ -74,9 +74,9 @@ class PhotosIndex extends Template $name = str_replace(' ', '', strtolower($header)); echo ' -

- ', $header, ' -

'; +

+ ', $header, ' +

'; $this->previous_header = $header; } @@ -84,7 +84,7 @@ class PhotosIndex extends Template protected function photo(Image $image, $className, $width, $height, $crop = true, $fit = true) { echo ' -
'; +
'; if ($this->show_edit_buttons) echo ' @@ -100,7 +100,10 @@ class PhotosIndex extends Template else echo ' srcset="', $image->getThumbnailUrl($image->width(), $image->height(), true), ' 2x"'; - echo ' alt="" title="', $image->getTitle(), '" style="width: ', $width, 'px; height: ', $height, 'px">'; + // Prefer thumbnail aspect ratio if available, otherwise use image aspect ratio. + $aspectRatio = isset($width, $height) ? $width / $height : $image->ratio(); + + echo ' alt="" title="', $image->getTitle(), '" style="aspect-ratio: ', $aspectRatio, '">'; if ($this->show_labels) echo ' @@ -115,7 +118,17 @@ class PhotosIndex extends Template protected function panorama(array $photos) { foreach ($photos as $image) + { + echo ' +
+
'; + $this->photo($image, 'panorama', static::PANORAMA_WIDTH, static::PANORAMA_HEIGHT, false, false); + + echo ' +
+
'; + } } protected function portrait(array $photos) @@ -123,19 +136,29 @@ class PhotosIndex extends Template $image = array_shift($photos); echo ' -
-
'; +
+
'; $this->photo($image, 'portrait', static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, 'centre'); echo '
-
'; +
+
'; foreach ($photos as $image) - $this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, 'centre'); + { + echo ' +
'; + + $this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, 'top'); + + echo ' +
'; + } echo ' +
'; } @@ -145,19 +168,29 @@ class PhotosIndex extends Template $image = array_shift($photos); echo ' -
-
'; +
+
'; $this->photo($image, 'landscape', static::LANDSCAPE_WIDTH, static::LANDSCAPE_HEIGHT, 'top'); echo '
-
'; +
+
'; foreach ($photos as $image) + { + echo ' +
'; + $this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, 'top'); + echo ' +
'; + } + echo ' +
'; } @@ -165,11 +198,19 @@ class PhotosIndex extends Template protected function duo(array $photos) { echo ' -
'; +
'; foreach ($photos as $image) + { + echo ' +
'; + $this->photo($image, 'duo', static::DUO_WIDTH, static::DUO_HEIGHT, true); + echo ' +
'; + } + echo '
'; } @@ -177,23 +218,33 @@ class PhotosIndex extends Template protected function single(array $photos) { echo ' -
'; +
+
'; $image = array_shift($photos); $this->photo($image, 'single', static::SINGLE_WIDTH, static::SINGLE_HEIGHT, 'top'); echo ' +
'; } protected function row(array $photos) { echo ' -
'; +
'; foreach ($photos as $image) + { + echo ' +
'; + $this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, true); + echo ' +
'; + } + echo '
'; } @@ -201,11 +252,19 @@ class PhotosIndex extends Template protected function portraits(array $photos) { echo ' -
'; +
'; foreach ($photos as $image) + { + echo ' +
'; + $this->photo($image, 'portrait', static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true); + echo ' +
'; + } + echo '
'; }