From 414346b7f14672efc4fee4400956eabd6293c791 Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Tue, 22 Mar 2022 19:28:28 +0100 Subject: [PATCH] 22-03-2022 --- css/sls.css | 47 ++++++- functions.php | 60 ++++++++- insert_bdd.php | 142 ++++++++++++++++---- maps.php | 93 +++++++++++++ maps2.php | 150 +++++++++++++++++++++ photo-du-mois-lc-lite.php | 275 ++++++++++++++++++++++++++++++++++++++ photo-du-mois-lc.php | 274 +++++++++++++++++++++++++++++++++++++ photo-du-mois-lg.php | 221 ++++++++++++++++++++++++++++++ photo-du-mois-ng.php | 215 +++++++++++++++++++++++++++++ photo-du-mois.php | 2 +- 10 files changed, 1440 insertions(+), 39 deletions(-) create mode 100644 maps.php create mode 100644 maps2.php create mode 100644 photo-du-mois-lc-lite.php create mode 100644 photo-du-mois-lc.php create mode 100644 photo-du-mois-lg.php create mode 100644 photo-du-mois-ng.php diff --git a/css/sls.css b/css/sls.css index 09b78fe..d88699a 100644 --- a/css/sls.css +++ b/css/sls.css @@ -41,6 +41,7 @@ a:link, a:visited { vertical-align: middle; } +/**/ .myGallery .caption { margin: 0; padding: 1em; @@ -59,7 +60,6 @@ a:link, a:visited { color: rgb(255, 255, 255); font-family: sans-serif; font-size: 1.2em - /*font: Ubuntu, sans-serif;*/ } .myGallery .item:hover .caption { @@ -164,4 +164,47 @@ body { } .exif { color: #999; -} \ No newline at end of file +} + +/* insert_bdd.php */ + +.styled-table { + border-collapse: collapse; + margin: 25px 0; + font-size: 0.9em; + font-family: sans-serif; + min-width: 400px; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.15); + } + +.styled-table thead tr { + background-color: #009879; + color: #ffffff; + text-align: left; + } + +.styled-table th, .styled-table td { + padding: 12px 15px; + } + +.styled-table tbody tr { + border-bottom: 1px solid #dddddd; + } + +.styled-table tbody tr:nth-of-type(even) { + background-color: #f3f3f3; + } + +.styled-table tbody tr:last-of-type { + border-bottom: 2px solid #009879; + } + +.styled-table tbody tr.active-row { + font-weight: bold; + color: #009879; + } + +.styled-table img { + width: 150px + } + diff --git a/functions.php b/functions.php index 7e3a97f..f928e93 100644 --- a/functions.php +++ b/functions.php @@ -9,7 +9,7 @@ function month($w) { //setlocale(LC_TIME, 'fr_FR'); $m = date('m', strtotime($w)); // month $y = date('Y', strtotime($w)); // year - //echo $m . "-" . $y; + //echo $w . "- month: " . $m . "- year: " . $y; // or any other locales like pl_PL, cs_CZ, fr_FR, zh, zh_Hans, ... $locale = 'fr_FR'; @@ -26,6 +26,10 @@ function month($w) { DateTime::createFromFormat('n', (string)$month_number) ); } + + array_unshift($months_locale,""); + unset($months_locale[0]); + //_pr($months_locale); $my = ucfirst($months_locale[(int)$m]) . " " . $y; //echo $my; return $my; @@ -38,16 +42,40 @@ function month($w) { */ function gps2Num($coordPart){ + /* + Array + ( + [0] => 46/1 + [1] => 408587/10000 + [2] => 0/0 + ) + Array + ( + [0] => 5/1 + [1] => 562596/10000 + [2] => 0/0 + ) + */ + $parts = explode('/', $coordPart); + //echo $parts[0].'-'.$parts[1].'
'; if(count($parts) <= 0) return 0; if(count($parts) == 1) return $parts[0]; - return floatval($parts[0]) / floatval($parts[1]); + if($parts[1] != 0) + return floatval($parts[0]) / floatval($parts[1]); + else return 0; } function get_gps($exif) { + if($exif && isset($exif['GPS'])){ + /* + echo $exif['FILE']['FileName']; + _pr($exif['GPS']['GPSLatitude']); + _pr($exif['GPS']['GPSLongitude']); + */ $GPSLatitudeRef = isset($exif['GPS']['GPSLatitudeRef']) ? $exif['GPS']['GPSLatitudeRef'] : ''; $GPSLatitude = isset($exif['GPS']['GPSLatitude']) ? $exif['GPS']['GPSLatitude'] : ''; $GPSLongitudeRef = isset($exif['GPS']['GPSLongitudeRef']) ? $exif['GPS']['GPSLongitudeRef'] : ''; @@ -57,18 +85,18 @@ function get_gps($exif) { $lat_degrees = count($GPSLatitude) > 0 ? gps2Num($GPSLatitude[0]) : 0; $lat_minutes = count($GPSLatitude) > 1 ? gps2Num($GPSLatitude[1]) : 0; $lat_seconds = count($GPSLatitude) > 2 ? gps2Num($GPSLatitude[2]) : 0; - - $lon_degrees = count($GPSLongitude) > 0 ? gps2Num($GPSLongitude[0]) : 0; + + $lon_degrees = count($GPSLongitude) > 0 ? gps2Num($GPSLongitude[0]) : 0; $lon_minutes = count($GPSLongitude) > 1 ? gps2Num($GPSLongitude[1]) : 0; $lon_seconds = count($GPSLongitude) > 2 ? gps2Num($GPSLongitude[2]) : 0; - + $lat_direction = ($GPSLatitudeRef == 'W' or $GPSLatitudeRef == 'S') ? -1 : 1; $lon_direction = ($GPSLongitudeRef == 'W' or $GPSLongitudeRef == 'S') ? -1 : 1; $latitude = $lat_direction * ($lat_degrees + ($lat_minutes / 60) + ($lat_seconds / (60*60))); $longitude = $lon_direction * ($lon_degrees + ($lon_minutes / 60) + ($lon_seconds / (60*60))); - $alt = explode('/', $exif['GPS']["GPSAltitude"]); + $alt = explode('/', $GPSAltitude); $altitude = (isset($alt[1])) ? ($alt[0] / $alt[1]) : $alt[0]; } else { @@ -77,11 +105,13 @@ function get_gps($exif) { $altitude = ''; } + //echo $latitude . " - " . $longitude . " - " . $altitude; + return array('latitude'=>$latitude, 'longitude'=>$longitude, 'altitude'=>$altitude); } -/* Fonction create_thumb(): Création des vigntettes +/* Fonction create_thumb(): Création des vignettes insert_bdd.php */ @@ -188,4 +218,20 @@ function geo_single_fracs2dec($fracs) { geo_frac2dec($fracs[2]) / 3600; } +/**/ +function host() { + $pv_sslport=443; + //$pv_serverport=80; + //$pv_servername="sur-le-sentier.fr"; + + $pv_URIprotocol = isset($_SERVER["HTTPS"]) ? (($_SERVER["HTTPS"]==="on" || $_SERVER["HTTPS"]===1 || $_SERVER["SERVER_PORT"]===$pv_sslport) ? "https://" : "http://") : (($_SERVER["SERVER_PORT"]===$pv_sslport) ? "https://" : "http://"); + if ($_SERVER['HTTP_HOST'] == "sur-le-sentier.fr") { + $host = $pv_URIprotocol . $_SERVER['HTTP_HOST'] . "/"; + } + elseif ($_SERVER['HTTP_HOST'] == "airbook.local") { + $host = $pv_URIprotocol . $_SERVER['HTTP_HOST'] . "/sls/"; + } + return $host; + } + ?> \ No newline at end of file diff --git a/insert_bdd.php b/insert_bdd.php index 2edcf6d..b45fc90 100644 --- a/insert_bdd.php +++ b/insert_bdd.php @@ -1,7 +1,25 @@ + + + + + + + + Insert photos in Sqlite base + + + + + + + + + + + + + Creation de la base ' . $base . ' et de la table photo (si nécessaire)...'; + // Création de la base et de la table photos $conn = new PDO("sqlite:db_photo.sqlite3"); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -37,7 +57,8 @@ $query = "CREATE TABLE IF NOT EXISTS photos ( UNIQUE(filename) )"; $conn->exec($query); -$conn = null; + +echo '

Lecture des fichiers images dans le dossier photos/img/...

'; $i = 1; @@ -85,10 +106,7 @@ foreach($fileList as $file){ 'long' => $gps['longitude'], 'alt' => $gps['altitude'] - ); - - //_pr($photos); - + ); } if ($iptc = getimagesize($file, $info)) { @@ -100,18 +118,18 @@ foreach($fileList as $file){ $titre = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : ''; $createur = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : ''; $mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : ''; - foreach ($mots_cles as $m) { - $mots .= $m . ","; - } - $mots = substr($mots, 0, -1); + if (!empty($mots_cles)) { + foreach ($mots_cles as $key => $val) { + $mots .= $val . ","; + } + $mots = substr($mots, 0, -1); + } $photos[$i]['legende'] = $legende; $photos[$i]['copyright'] = $copyright; $photos[$i]['titre'] = $titre; $photos[$i]['createur'] = $createur; $photos[$i]['mots_cles'] = $mots; - - //_pr($photos); } } } @@ -119,15 +137,40 @@ foreach($fileList as $file){ $i++; } -//_pr($photos); +$query5 = "SELECT MAX(id) FROM photos"; +//$conn->$stmt->execute($query5); +$stmt = $conn->prepare($query5); +$stmt->execute(); +//$resultat = $stmt->fetchAll(PDO::FETCH_ASSOC); +/* +Array + ( + [0] => Array + ( + [MAX(id)] => 5 + ) + + ) +*/ +$resultat = $stmt->fetch(PDO::FETCH_ASSOC); +/* +Array + ( + [MAX(id)] => 5 + ) +*/ +//_pr($resultat); +$nb_avant = $resultat['MAX(id)']; + + +echo '

Création des vignettes dans le dossier photos/thumb/ et insertion dans la base...

'; // Insertion des photos dans la base // Création des vignettes try { - $conn2 = new PDO('sqlite:db_photo.sqlite3'); $query2 = "INSERT OR IGNORE INTO photos (filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords) VALUES (:filename, :date, :lens, :exposure, :iso, :width, :height, :html, :aperture, :model, :lat, :long, :alt, :legende, :copyright, :titre, :createur, :keywords)"; - $stmt = $conn2->prepare($query2); + $stmt = $conn->prepare($query2); $stmt->bindParam(':filename', $file); $stmt->bindParam(':date', $da); $stmt->bindParam(':lens', $obj); @@ -175,31 +218,72 @@ try { $stmt->execute(); } } - - $conn2 = null; } catch(PDOException $e) { echo $e->getMessage(); } -/* Affichage depuis la bdd */ -/**/ +/* Affichage depuis la bdd des dernières images ajoutées */ +/* */ try { - $conn4 = new PDO('sqlite:db_photo.sqlite3'); - $query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos WHERE id >= ? AND id <= ? ORDER BY date DESC"; + $query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos WHERE id > ? ORDER BY date DESC"; + //$query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos WHERE lat != '' OR long != '' ORDER BY date DESC"; - $stmt = $conn4->prepare($query4); + $stmt = $conn->prepare($query4); + $stmt->bindValue(1, $nb_avant, SQLITE3_INTEGER); // (1,3...) 1=1ere valeur 3=valeur # id 1 -> 3 - $stmt->execute(array(1, 3)); + //$stmt->execute(array(1, 3)); // WHERE id >= ? AND id <= ? ORDER BY date DESC"; + $stmt->execute(); - $result = $stmt->fetchAll(PDO::FETCH_ASSOC); - _pr($result); + //$row = $stmt->fetchAll(PDO::FETCH_ASSOC); + //_pr($result); + + echo '

Lecture des photos ajoutées:

'; + echo '
'; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']); + $full = host() . $row['filename']; + //echo ' | ' . $row['filename'] . ' | ' . $row['date'] . ' | ' . $row['lens'] . ' | ' . $row['exposure'] . ' | ' . $row['iso'] . ' | ' . $row['width'] . ' | ' . $row['height'] . ' | ' . $row['html'] . ' | ' . $row['aperture'] . ' | ' . $row['model'] . ' | ' . $row['lat'] . ' | ' . $row['long'] . ' | ' . $row['alt'] . ' | ' . $row['legende'] . ' | ' . $row['copyright'] . ' | ' . $row['titre'] . ' | ' . $row['createur'] . " |\r\n"; + echo ''; + } + echo '
ThumbFilenameDateLensExposureIsoWidthHeightHtmlApertureModelLatLongAltLegendeCopyrightTitreCreateurKeywords
' . '' . '' . $row['filename'] . '' . $row['date'] . '' . $row['lens'] . '' . $row['exposure'] . '' . $row['iso'] . '' . $row['width'] . '' . $row['height'] . '' . $row['html'] . '' . $row['aperture'] . '' . $row['model'] . '' . $row['lat'] . '' . $row['long'] . '' . $row['alt'] . '' . $row['legende'] . '' . $row['copyright'] . '' . $row['titre'] . '' . $row['createur'] . '' . $row['keywords'] . '
'; + echo '
'; - $conn4 = null; + $conn = null; } catch(PDOException $e) { echo $e->getMessage(); } +?> -?> \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/maps.php b/maps.php new file mode 100644 index 0000000..b6ee950 --- /dev/null +++ b/maps.php @@ -0,0 +1,93 @@ + + + + + + + + Photo du mois + + + + + + + + + + + + + + + + + +

+ +prepare($query4); + $stmt->execute(array($limit, $offset)); + + $result = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rowcount = count($result); + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + _pr($result); + + $imgLat = $result[0]['lat']; + $imgLng = $result[0]['long']; +?> + + + +
+ + +

@ 2022

+ + + + + + + \ No newline at end of file diff --git a/maps2.php b/maps2.php new file mode 100644 index 0000000..f241298 --- /dev/null +++ b/maps2.php @@ -0,0 +1,150 @@ + + + + + + + + Photo du mois + + + + + + + + + + + + + + + + + +

+ +prepare($query4); + $stmt->execute(array($limit, $offset)); + + $result = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rowcount = count($result); + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + //_pr($result); +?> + +
+ + + + + +

@ 2022

+ + + + + + + \ No newline at end of file diff --git a/photo-du-mois-lc-lite.php b/photo-du-mois-lc-lite.php new file mode 100644 index 0000000..ed657b1 --- /dev/null +++ b/photo-du-mois-lc-lite.php @@ -0,0 +1,275 @@ + + + + + + + + Photo du mois + + + + + + + + + + + + + + + +

+ + + +prepare($query4); + $stmt->execute(array($limit, $offset)); + + $result = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rowcount = count($result); + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + $photo_du_mois = $result[0]; + $z = $photo_du_mois['date']; + + $photo_du_mois['titre'] = "Titre"; + $photo_du_mois['legende'] = "Légende"; + + if (!empty($photo_du_mois['titre'])) { + $x = $photo_du_mois['titre']; + $y = $photo_du_mois['legende']; + } + elseif (!empty($photo_du_mois['legende'])) { + $x = $photo_du_mois['legende']; + } + else { + $x = basename($photo_du_mois['filename']); + $y = ""; + } + + $month_exif = $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} " . $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO"; +?> + +

+ +'; + echo ''; + // data-lcl-author= + echo ''; + + echo ""; + echo ''; + + if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) { + ?> +

+

+ '; + //echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} "; + //echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO"; + echo $month_exif; + echo ''; +?> + + +'; + } + + /* + $rowcount = 5 - 10 - 15 => add 0 + $rowcount = 4 - 9 - 14 => add 1 + $rowcount = 3 - 8 - 13 => add 2 + $rowcount = 2 - 7 - 12 => add 3 + $rowcount = 1 - 6 - 11 => add 4 + */ + + if ($rowcount % 4 == 0) $blank = 1; + elseif ($rowcount % 3 == 0) $blank = 2; + elseif ($rowcount % 2 == 0) $blank = 3; + elseif ($rowcount % 1 == 0) $blank = 4; + + for ($i = 1; $i <= $blank; $i++) { + echo '
'; + echo '
'; + } + ?> + + + + + + +prepare($query4); + $stmt->execute(); + + $result = $stmt->fetch(PDO::FETCH_ASSOC); + $numRows = $result['count']; + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + +// calcul du nombre de pages (arrondi a l'entier supérieur) +$nbpages = ceil($numRows / 12); +$prec = $page - 1; +$suiv = $page + 1; + +echo ''; + +?> + +

@ 2022

+ + + + + + + \ No newline at end of file diff --git a/photo-du-mois-lc.php b/photo-du-mois-lc.php new file mode 100644 index 0000000..8413dfe --- /dev/null +++ b/photo-du-mois-lc.php @@ -0,0 +1,274 @@ + + + + + + + + Photo du mois + + + + + + + + + + + + + + +

+ + + +prepare($query4); + $stmt->execute(array($limit, $offset)); + + $result = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rowcount = count($result); + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + $photo_du_mois = $result[0]; + $z = $photo_du_mois['date']; + + $photo_du_mois['titre'] = "Titre"; + $photo_du_mois['legende'] = "Légende"; + + if (!empty($photo_du_mois['titre'])) { + $x = $photo_du_mois['titre']; + $y = $photo_du_mois['legende']; + } + elseif (!empty($photo_du_mois['legende'])) { + $x = $photo_du_mois['legende']; + } + else { + $x = basename($photo_du_mois['filename']); + $y = ""; + } + + $month_exif = $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} " . $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO"; +?> + +

+ +'; + echo ''; + // data-lcl-author= + echo ''; + + echo ""; + echo ''; + + if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) { + ?> +

+

+ '; + //echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} "; + //echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO"; + echo $month_exif; + echo ''; +?> + + +'; + } + + /* + $rowcount = 5 - 10 - 15 => add 0 + $rowcount = 4 - 9 - 14 => add 1 + $rowcount = 3 - 8 - 13 => add 2 + $rowcount = 2 - 7 - 12 => add 3 + $rowcount = 1 - 6 - 11 => add 4 + */ + + if ($rowcount % 4 == 0) $blank = 1; + elseif ($rowcount % 3 == 0) $blank = 2; + elseif ($rowcount % 2 == 0) $blank = 3; + elseif ($rowcount % 1 == 0) $blank = 4; + + for ($i = 1; $i <= $blank; $i++) { + echo '
'; + echo '
'; + } + ?> + + + + + + +prepare($query4); + $stmt->execute(); + + $result = $stmt->fetch(PDO::FETCH_ASSOC); + $numRows = $result['count']; + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + +// calcul du nombre de pages (arrondi a l'entier supérieur) +$nbpages = ceil($numRows / 12); +$prec = $page - 1; +$suiv = $page + 1; + +echo ''; + +?> + +

@ 2022

+ + + + + + + \ No newline at end of file diff --git a/photo-du-mois-lg.php b/photo-du-mois-lg.php new file mode 100644 index 0000000..d729e66 --- /dev/null +++ b/photo-du-mois-lg.php @@ -0,0 +1,221 @@ + + + + + + + + Document + + + + + + + + + + + + + + + + + + + + + + +

+ + + +prepare($query4); + $stmt->execute(array($limit, $offset)); + + $result = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rowcount = count($result); + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + $photo_du_mois = $result[0]; + $z = $photo_du_mois['date']; + + $photo_du_mois['titre'] = "Titre"; + $photo_du_mois['legende'] = "Légende"; + +?> + +

+ +'; + echo ''; + echo ''; + + if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) { + ?> +

+

+ '; + echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} "; + echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO"; + echo ''; +?> + + +
+ + '; + echo ''; + //echo ''; + echo '' . $x . ''; + echo '

' . $x . '

' . $legende . '

'; + + echo "
"; + //echo '' . month($date) . ''; + //echo '
'; + } + + /* + $rowcount = 5 - 10 - 15 => add 0 + $rowcount = 4 - 9 - 14 => add 1 + $rowcount = 3 - 8 - 13 => add 2 + $rowcount = 2 - 7 - 12 => add 3 + $rowcount = 1 - 6 - 11 => add 4 + */ + + if ($rowcount % 4 == 0) $blank = 1; + elseif ($rowcount % 3 == 0) $blank = 2; + elseif ($rowcount % 2 == 0) $blank = 3; + elseif ($rowcount % 1 == 0) $blank = 4; + + /* + for ($i = 1; $i <= $blank; $i++) { + echo '
'; + echo '
'; + } + */ + ?> + + + + + + +prepare($query4); + $stmt->execute(); + + $result = $stmt->fetch(PDO::FETCH_ASSOC); + $numRows = $result['count']; + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + +// calcul du nombre de pages (arrondi a l'entier supérieur) +$nbpages = ceil($numRows / 12); +$prec = $page - 1; +$suiv = $page + 1; + +echo ''; + +?> + +

@ 2022

+ + + + + \ No newline at end of file diff --git a/photo-du-mois-ng.php b/photo-du-mois-ng.php new file mode 100644 index 0000000..f898522 --- /dev/null +++ b/photo-du-mois-ng.php @@ -0,0 +1,215 @@ + + + + + + + + Document + + + + + + + + + + + + + + + + +

+ + + +prepare($query4); + $stmt->execute(array($limit, $offset)); + + $result = $stmt->fetchAll(PDO::FETCH_ASSOC); + $rowcount = count($result); + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + $photo_du_mois = $result[0]; + $z = $photo_du_mois['date']; + + $photo_du_mois['titre'] = "Titre"; + $photo_du_mois['legende'] = "Légende"; + +?> + +

+ +'; + echo ''; + echo ''; + + if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) { + ?> +

+

+ '; + echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} "; + echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO"; + echo ''; +?> + + + +
+ + '; + //echo ''; + echo ''; + echo '' . $x . ''; + //echo "bla"; + echo ""; + //echo '' . month($date) . ''; + echo '
'; + } + + /* + $rowcount = 5 - 10 - 15 => add 0 + $rowcount = 4 - 9 - 14 => add 1 + $rowcount = 3 - 8 - 13 => add 2 + $rowcount = 2 - 7 - 12 => add 3 + $rowcount = 1 - 6 - 11 => add 4 + */ + + if ($rowcount % 4 == 0) $blank = 1; + elseif ($rowcount % 3 == 0) $blank = 2; + elseif ($rowcount % 2 == 0) $blank = 3; + elseif ($rowcount % 1 == 0) $blank = 4; + + for ($i = 1; $i <= $blank; $i++) { + echo '
'; + echo '
'; + } + ?> + + + + + + +prepare($query4); + $stmt->execute(); + + $result = $stmt->fetch(PDO::FETCH_ASSOC); + $numRows = $result['count']; + + $conn4 = null; + } + catch(PDOException $e) { + echo $e->getMessage(); + } + + +// calcul du nombre de pages (arrondi a l'entier supérieur) +$nbpages = ceil($numRows / 12); +$prec = $page - 1; +$suiv = $page + 1; + +echo ''; + +?> + +

@ 2022

+ + + + \ No newline at end of file diff --git a/photo-du-mois.php b/photo-du-mois.php index 5aa0a86..d95c7ea 100644 --- a/photo-du-mois.php +++ b/photo-du-mois.php @@ -179,7 +179,7 @@ try { else $x = basename($file); $exif = $model . " \u{30FB} " . $objectif . " \u{30FB} " . $exposure . " \u{30FB} " . $aperture . " \u{30FB} " . $iso ; - $x = $x . "\r\n" . $exif; + // $x = $x . "\r\n" . $exif; $thumb = str_replace("photos/img", "photos/thumb", $file);