12-08-2022
This commit is contained in:
@@ -37,7 +37,7 @@ $base = 'db_photo.sqlite3';
|
||||
$th_w = 300;
|
||||
$th_h = 300;
|
||||
|
||||
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP$/');
|
||||
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP|avif|AVIF$/');
|
||||
|
||||
echo '<h3>' . count($dir) . gettext(' images found in folder') . ' <i>photos/img/</i> ...</h3>';
|
||||
|
||||
@@ -49,7 +49,7 @@ $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$query = "CREATE TABLE IF NOT EXISTS photos (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
filename TEXT NOT NULL,
|
||||
date TEXT,
|
||||
dateoriginal TEXT,
|
||||
lens TEXT,
|
||||
speed TEXT,
|
||||
iso INTEGER,
|
||||
@@ -96,6 +96,12 @@ foreach($dir as $file){
|
||||
|
||||
# YYYY-MM-DD HH:MM:SS.SSS - 2019:10:01 14:03:12
|
||||
$da = isset($exif['EXIF']['DateTimeOriginal']) ? $exif['EXIF']['DateTimeOriginal'] : '';
|
||||
if (isset($exif['EXIF']['DateTimeOriginal'])) {
|
||||
$d = explode(' ', $exif['EXIF']['DateTimeOriginal']);
|
||||
$da = str_replace(':', '-', $d[0]) . " " . $d[1] . ".000";
|
||||
} else {
|
||||
$d = '';
|
||||
}
|
||||
|
||||
if (isset($exif['EXIF']['UndefinedTag:0xA434'])) {
|
||||
$w = $exif['EXIF']['UndefinedTag:0xA434'];
|
||||
@@ -274,11 +280,15 @@ foreach($dir as $file){
|
||||
$ap = isset($exif['COMPUTED']['ApertureFNumber']) ? $exif['COMPUTED']['ApertureFNumber'] : '';
|
||||
|
||||
$gps = get_gps($exif);
|
||||
|
||||
if ($gps['latitude'] != "") {
|
||||
echo "lat: " . $gps['latitude'] . "<br>";
|
||||
echo "long: " . $gps['longitude'] . "<br>";
|
||||
echo "alt: " . $gps['altitude'] . "<br>";
|
||||
}
|
||||
$photos[$i] = array(
|
||||
'filename' => $file,
|
||||
|
||||
'date' => $da,
|
||||
'dateoriginal' => $da,
|
||||
'lens' => $obj,
|
||||
'speed' => $sp,
|
||||
'iso' => $iso,
|
||||
@@ -364,11 +374,11 @@ echo '<h3>' . gettext('Insertion of ') . $z . ' ' . $b . gettext(' in database')
|
||||
// Insertion des photos dans la base
|
||||
// Création des vignettes
|
||||
try {
|
||||
$query2 = "INSERT OR IGNORE INTO photos (filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program) VALUES (:filename, :date, :lens, :speed, :iso, :width, :height, :html, :aperture, :model, :lat, :long, :alt, :legende, :copyright, :title, :creator, :keywords, :metering, :flash, :focal, :wb, :program)";
|
||||
$query2 = "INSERT OR IGNORE INTO photos (filename, dateoriginal, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program) VALUES (:filename, :dateoriginal, :lens, :speed, :iso, :width, :height, :html, :aperture, :model, :lat, :long, :alt, :legende, :copyright, :title, :creator, :keywords, :metering, :flash, :focal, :wb, :program)";
|
||||
|
||||
$stmt = $conn->prepare($query2);
|
||||
$stmt->bindParam(':filename', $file);
|
||||
$stmt->bindParam(':date', $da);
|
||||
$stmt->bindParam(':dateoriginal', $da);
|
||||
$stmt->bindParam(':lens', $obj);
|
||||
$stmt->bindParam(':speed', $sp);
|
||||
$stmt->bindParam(':iso', $iso);
|
||||
@@ -397,7 +407,7 @@ try {
|
||||
if (isset($photos)) {
|
||||
foreach ($photos as $item) {
|
||||
$file = $item['filename'];
|
||||
$da = $item['date'];
|
||||
$da = $item['dateoriginal'];
|
||||
$obj = $item['lens'];
|
||||
$sp = $item['speed'];
|
||||
$iso = $item['iso'];
|
||||
@@ -434,9 +444,9 @@ try {
|
||||
|
||||
|
||||
/* Affichage depuis la bdd des dernières images ajoutées */
|
||||
|
||||
/*
|
||||
try {
|
||||
$query4 = "SELECT filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program FROM photos WHERE id > ? ORDER BY date DESC";
|
||||
$query4 = "SELECT filename, dateoriginal, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords, metering, flash, focal, wb, program FROM photos WHERE id > ? ORDER BY dateoriginal DESC";
|
||||
//$query4 = "SELECT filename, date, lens, speed, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, title, creator, keywords FROM photos WHERE lat != '' OR long != '' ORDER BY date DESC";
|
||||
|
||||
$stmt = $conn->prepare($query4);
|
||||
@@ -461,7 +471,7 @@ try {
|
||||
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
|
||||
$full = host() . $row['filename'];
|
||||
|
||||
echo '<tr><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td><td>' . $row['filename'] . '</td><td>' . $row['date'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['width'] . '</td><td>' . $row['height'] . '</td><td>' . $row['html'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['model'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['legende'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['program'] . '</td></tr>';
|
||||
echo '<tr><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td><td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['width'] . '</td><td>' . $row['height'] . '</td><td>' . $row['html'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['model'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['legende'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['program'] . '</td></tr>';
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
echo '</div>';
|
||||
@@ -471,6 +481,7 @@ try {
|
||||
catch(PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
*/
|
||||
?>
|
||||
|
||||
<script type='text/javascript'>
|
||||
|
||||
Reference in New Issue
Block a user