match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP$/'); echo '

' . count($dir) . gettext(' images found in folder') . ' photos/img/ ...

'; $conn = new PDO("sqlite:db_photo.sqlite3"); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Construction des requêtes $request = array( 'lens' => 'SELECT DISTINCT lens FROM photos WHERE lens <> "" ORDER BY lens', 'model' => 'SELECT DISTINCT model FROM photos WHERE model <> "" ORDER BY model', 'iso' => 'SELECT DISTINCT iso FROM photos WHERE iso <> "" ORDER BY iso', 'speed' => 'SELECT DISTINCT speed FROM photos WHERE speed <> "" ORDER BY speed', 'keywords' => 'SELECT DISTINCT keywords FROM photos WHERE keywords <> ""' ); $select = array(); $i = 0; foreach ($request as $key => $val){ $query = $conn->query($val); $select[$i] = $query->fetchAll(PDO::FETCH_ASSOC); $select[$i] = array_column($select[$i],$key); if ($i == 4){ $mc = array(); foreach($select[$i] as $row){ $x = explode(",", $row); foreach ($x as $y){ if ((! str_starts_with($y, "_")) && (! str_ends_with($y, "_"))) { $mc [] = $y; } } } $motcles = array_unique($mc); usort($motcles, 'strcasecmp'); // 'strcasecmp' $select[$i] = $motcles; } $i++; } // Affichage des photos try { $columns = array('date','lens','model','iso','lat'); $column = isset($_GET['column']) && in_array($_GET['column'], $columns) ? $_GET['column'] : $columns[0]; $sort_order = isset($_GET['order']) && strtolower($_GET['order']) == 'desc' ? 'DESC' : 'ASC'; // SELECT id,filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program if (isset($_POST['lens'])) $req = "WHERE lens = '" . $_POST['lens'] . "' "; elseif (isset($_POST['model'])) $req = "WHERE model = '" . $_POST['model'] . "' "; elseif (isset($_POST['iso'])) $req = "WHERE iso = '" . $_POST['iso'] . "' "; elseif (isset($_POST['speed'])) $req = "WHERE speed = '" . $_POST['speed'] . "' "; elseif (isset($_POST['keyword'])) $req = "WHERE keywords LIKE '%" . str_replace("'","''", $_POST['keyword']) . "%' "; else $req = ""; $query = "SELECT * FROM photos " . $req . "ORDER BY " . $column . " " . $sort_order . " " . "LIMIT ? OFFSET ?"; echo '
' . $query . '
'; $offset = $perpage * ($page -1); $stmt = $conn->prepare($query); $stmt->execute(array($perpage, $offset));// (1,3...) 1=1ere valeur 3=valeur # id 1 -> 3 //$stmt->execute(array(1, 3)); // WHERE id >= ? AND id <= ? ORDER BY date DESC"; //$result = $stmt->fetchAll(PDO::FETCH_ASSOC); //$count = $rows['count(*)']; //echo count($result); //_pr($rows); $up_or_down = str_replace(array('ASC','DESC'), array('up','down'), $sort_order); $asc_or_desc = $sort_order == 'ASC' ? 'desc' : 'asc'; $add_class = ' class="highlight"'; ?>
'; echo ''; 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 ''; } echo '
' . gettext('Id') . '' . gettext('Thumb') . '' . gettext('Filename') . '' . gettext('Date') . ' ' . gettext('Lens') . ' ' . gettext('Speed') . '' . gettext('Iso') . ' ' . gettext('Width') . '' . gettext('Height') . '' . gettext('Html') . '' . gettext('Aperture') . '' . gettext('Model') . ' ' . gettext('Latitude') . ' ' . gettext('Longitude') . '' . gettext('Alttitude') . '' . gettext('Legende') . '' . gettext('Copyright') . '' . gettext('Title') . '' . gettext('Creator') . '' . gettext('Keywords') . '' . gettext('Metering') . '' . gettext('Flash') . '' . gettext('Focal') . '' . gettext('Wb') . '' . gettext('Program') . '
' . $row['id'] . '' . '' . '' . $row['filename'] . '' . $row['date'] . '' . $row['lens'] . '' . $row['speed'] . '' . $row['iso'] . '' . $row['width'] . '' . $row['height'] . '' . $row['html'] . '' . $row['aperture'] . '' . $row['model'] . '' . $row['lat'] . '' . $row['long'] . '' . $row['alt'] . '' . $row['legende'] . '' . $row['copyright'] . '' . $row['title'] . '' . $row['creator'] . '' . $row['keywords'] . '' . $row['metering'] . '' . $row['flash'] . '' . $row['focal'] . '' . $row['wb'] . '' . $row['program'] . '
'; echo ''; //$stmt = $conn->reset(); //$conn = null; } catch(PDOException $e) { echo $e->getMessage(); } ?> prepare($query4); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); $numRows = $result['count']; $conn = null; } catch(PDOException $e) { echo $e->getMessage(); } // calcul du nombre de pages (arrondi a l'entier supérieur) $nbpages = ceil($numRows / $perpage); $prec = $page - 1; $suiv = $page + 1; echo ''; ?>

© 2013- sur-le-sentier.fr