Version 1.1
-réécriture de la fonction create_thumb: pour les images format portrait, les vignettes sont redimensionner à 300px de large, puis cropées à 300x200. Toutes les vignettes sont au format paysage. -quelques corrections de bugs
This commit is contained in:
@@ -56,6 +56,7 @@ else $page = intval($_GET['page']);
|
||||
|
||||
<?php
|
||||
$chemin = 'photos/img/';
|
||||
$chemin_thumb = str_replace("img", "thumb", $chemin);
|
||||
|
||||
$base = 'db_photo.sqlite3';
|
||||
|
||||
@@ -188,12 +189,33 @@ else exit("Database " . $base . " does not exist !");
|
||||
} else {
|
||||
$meta = '';
|
||||
}
|
||||
|
||||
|
||||
echo '<div class="item">';
|
||||
|
||||
echo '<a href ="' . $lb['big'] . '" title="' . htmlspecialchars($lb['title']) . '" data-lcl-txt="' . htmlspecialchars($lb['description']) . '" data-lcl-author="' . htmlspecialchars($lb['creator']) . '">';
|
||||
|
||||
/*
|
||||
if ($lb['width'] > $lb['height']) {
|
||||
echo '<img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '">';
|
||||
}
|
||||
else {
|
||||
$f = $chemin . $result[$i]['filename'];
|
||||
$image = new Imagick($f);
|
||||
|
||||
$new_w = 300;
|
||||
$new_h = 200;
|
||||
|
||||
$resize_w = $new_w;
|
||||
$resize_h = $lb['height'] * $new_w / $lb['width']; // 450
|
||||
|
||||
$image->resizeImage($resize_w, $resize_h, Imagick::FILTER_LANCZOS, 0.9); // 300 x 300
|
||||
$image->cropImage($new_w, $new_h, ($resize_w - $new_w) / 2, ($resize_h - $new_h) / 2); // (w, h, x ,y) (xy coin haut gauche) (300, 200, 0, 125)
|
||||
|
||||
$thu = $chemin_thumb ."_" . $result[$i]['filename'];;
|
||||
$image->writeImage($thu);
|
||||
|
||||
echo '<img src="' . $thu . '" alt="' . htmlspecialchars($lb['title']) . '">';
|
||||
}
|
||||
*/
|
||||
echo '<img src="' . $lb['thumb'] . '" alt="' . htmlspecialchars($lb['title']) . '">';
|
||||
echo "</a>";
|
||||
echo '<span class="caption">' . month($date) . '</span>';
|
||||
|
||||
Reference in New Issue
Block a user