Mise-à-jour sur-le-sentier.fr
version 2
This commit is contained in:
475
clean_bdd.php
475
clean_bdd.php
@@ -1,3 +1,9 @@
|
||||
<?php require ("3-protect.php");
|
||||
include 'localize.php';
|
||||
$domain = 'sentier';
|
||||
localize($domain);
|
||||
include 'functions.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@@ -5,31 +11,20 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title><?php gettext('Clean photos in Sqlite base'); ?></title>
|
||||
<title><?php echo gettext('Clean photos in Sqlite base'); ?></title>
|
||||
|
||||
<link rel="stylesheet" href="css/sls.css" />
|
||||
<link rel='stylesheet' href='css/lc_lightbox.min.css' />
|
||||
<link rel='stylesheet' href='css/open_close_fx.css' />
|
||||
<link rel='stylesheet' href='css/minimal.css' />
|
||||
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
|
||||
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
|
||||
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
|
||||
|
||||
<?php include 'functions.php';
|
||||
session_start();
|
||||
if($_SESSION['Active'] == false){ /* Redirects user to login.php if not logged in */
|
||||
header("location:admin/login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$domain = 'sentier';
|
||||
localize($domain);
|
||||
?>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1><?php echo gettext('Clean / repare database'); ?></h1>
|
||||
<h1><?php echo gettext('Clean / repare database'); ?></h1><br />
|
||||
|
||||
<?php
|
||||
|
||||
@@ -43,14 +38,19 @@ $img_path = "photos/img/";
|
||||
$thumb_path = "photos/thumb/";
|
||||
|
||||
|
||||
echo '<h2>' . gettext('Clean folder img...') . '</h2>';
|
||||
echo '<h3>' . gettext('Clean folder img...') . '</h3>';
|
||||
|
||||
$originals = array_map('basename', glob('photos/img/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE));
|
||||
$thumbs = array_map('basename', glob('photos/thumb/*.{jpg,jpeg,JPG,JPEG,heic,HEIC,webp,WEBP}', GLOB_BRACE));
|
||||
|
||||
// On recherche les vignettes manquantes
|
||||
|
||||
$missing_thumbs = array_diff($originals, $thumbs);
|
||||
$a = count($missing_thumbs);
|
||||
echo '<h3>' . gettext('Missing thumbs: ') . $a . '</h3>';
|
||||
echo '<h4>' . gettext('Missing thumbs: ') . $a . '</h4>';
|
||||
|
||||
|
||||
// On crée les vignettes manquantes
|
||||
|
||||
if ($a > 0) {
|
||||
echo '<h4>' . gettext('Create missing thumbs...') . '</h4>';
|
||||
@@ -64,10 +64,15 @@ if ($a > 0) {
|
||||
}
|
||||
|
||||
|
||||
// On recherche les vignettes en trop
|
||||
|
||||
$extra_thumbs = array_diff($thumbs, $originals);
|
||||
$b = count($extra_thumbs);
|
||||
echo '<h3>' . gettext('Extra thumbs: ') . $b . '</h3>';
|
||||
//_pr($extra_thumbs);
|
||||
echo '<h4>' . gettext('Extra thumbs: ') . $b . '</h4>';
|
||||
|
||||
|
||||
// On efface les vignettes en trop
|
||||
|
||||
if ($b > 0) {
|
||||
echo '<h4>' . gettext('Delete extra thumbs...') . '</h4>';
|
||||
|
||||
@@ -82,7 +87,9 @@ if ($b > 0) {
|
||||
}
|
||||
|
||||
|
||||
echo '<h2>' . gettext('Compare folder img and database...') . '</h2>';
|
||||
// On compare le dossier 'img' et la base
|
||||
|
||||
echo '<h3>' . gettext('Compare folder img and database...') . '</h3>';
|
||||
|
||||
try {
|
||||
$conn = new PDO("sqlite:db_photo.sqlite3");
|
||||
@@ -108,15 +115,17 @@ foreach($result as $file) {
|
||||
$bdd[] = $file->filename;
|
||||
}
|
||||
|
||||
|
||||
$base = array_map('basename', $bdd);
|
||||
echo count($base) . " entries in database". "<br />";
|
||||
echo count($originals) . " files on disk" . "<br />";
|
||||
echo '<h4>' . count($base) . " entries in database". "</h4>";
|
||||
echo '<h4>' . count($originals) . " files on disk" . "</h4>";
|
||||
|
||||
$extra_in_bdd= array_diff($base, $originals);
|
||||
$c = count($extra_in_bdd);
|
||||
|
||||
echo '<h3>' . gettext('Extra images in database: ') . $c . '</h3>';
|
||||
echo '<h4>' . gettext('Extra images in database: ') . $c . '</h4>';
|
||||
|
||||
|
||||
// On supprime les images en trop dans la base
|
||||
|
||||
if ($c > 0) {
|
||||
echo '<h4>' . gettext('Delete extra images in database...') . '</h4>';
|
||||
@@ -137,10 +146,13 @@ if ($c > 0) {
|
||||
$missing_in_bdd = array_diff($originals, $base);
|
||||
$d = count($missing_in_bdd);
|
||||
|
||||
echo '<h3>' . gettext('Missing images in database: ') . $d . '</h3>';
|
||||
|
||||
echo '<h4>' . gettext('Missing images in database: ') . $d . '</h4>';
|
||||
|
||||
|
||||
// On ajoute les images manquantes dans la base
|
||||
|
||||
if ($d > 0) {
|
||||
echo '<h4>' . gettext('Adding missing images in database...') . '</h4>';
|
||||
echo '<h3>' . gettext('Adding missing images in database...') . '</h3>';
|
||||
|
||||
$i = 1;
|
||||
$photos = array();
|
||||
@@ -150,16 +162,34 @@ if ($d > 0) {
|
||||
$query4 = "INSERT INTO photos WHERE filename=:filename";
|
||||
|
||||
if ($exif = @exif_read_data($file, 0, true )) {
|
||||
|
||||
$mod = isset($exif['IFD0']['Model']) ? $exif['IFD0']['Model'] : '';
|
||||
|
||||
# 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']['UndefinedTag:0xA434'])) {
|
||||
$w = $exif['EXIF']['UndefinedTag:0xA434'];
|
||||
|
||||
//_pr($exif);
|
||||
|
||||
$arr = array("100.0 mm" => "EF100mm f/2.8 Macro USM", "100.0-400.0 mm" => "EF100-400mm f/4.5-5.6L IS USM", "140.0-560.0 mm" => "EF100-400mm f/4.5-5.6L IS USM +1.4x II", "17.0-40.0 mm" => "EF17-40mm f/4L USM", "24-70mm" => "SIGMA 24-70mm F2.8 EX DG", "70.0-200.0 mm" => "EF70-200mm f/4L USM", "10.0-22.0 mm" => "EF-S10-22mm f/3.5-4.5 USM", "500.0 mm" => "Sigma 500mm f/4.5 EX HSM ", "500mm" => "Sigma 500mm f/4.5 EX HSM ");
|
||||
unset($fla);
|
||||
unset($flash);
|
||||
|
||||
// filename
|
||||
//echo "File: " . $file . "<br>";
|
||||
|
||||
// filesize
|
||||
$fs = isset($exif['FILE']['FileSize']) ? $exif['FILE']['FileSize'] : '';
|
||||
$fsize = formatBytes($fs, $precision = 0);
|
||||
|
||||
// dateoriginal
|
||||
# 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 = '';
|
||||
}
|
||||
|
||||
// lens
|
||||
if (isset($exif['EXIF']['UndefinedTag:0xA434'])) {
|
||||
$w = trim($exif['EXIF']['UndefinedTag:0xA434']);
|
||||
|
||||
$arr = array("600" => "EF600mm f/4L IS III USM", "100.0 mm" => "EF100mm f/2.8 Macro USM", "100.0-400.0 mm" => "EF100-400mm f/4.5-5.6L IS USM", "140.0-560.0 mm" => "EF100-400mm f/4.5-5.6L IS USM +1.4x II", "17.0-40.0 mm" => "EF17-40mm f/4L USM", "24-70mm" => "SIGMA 24-70mm F2.8 EX DG", "70.0-200.0 mm" => "EF70-200mm f/4L USM", "10.0-22.0 mm" => "EF-S10-22mm f/3.5-4.5 USM", "500.0 mm" => "SIGMA 500mm f/4.5 EX HSM", "500mm" => "SIGMA 500mm f/4.5 EX HSM");
|
||||
|
||||
if (array_key_exists($w, $arr)) $obj= $arr[$w];
|
||||
else $obj = $w;
|
||||
@@ -168,15 +198,47 @@ if ($d > 0) {
|
||||
$obj = '';
|
||||
}
|
||||
|
||||
// speed
|
||||
if (isset($exif['EXIF']['ExposureTime'])) {
|
||||
$q = explode('/', $exif['EXIF']['ExposureTime']);
|
||||
$sp = ($q[0] > 1) ? ($q[0] / $q[1]) . "s" : $exif['EXIF']['ExposureTime'];
|
||||
} else {
|
||||
$sp = '';
|
||||
}
|
||||
|
||||
// aperture
|
||||
$ap = isset($exif['COMPUTED']['ApertureFNumber']) ? $exif['COMPUTED']['ApertureFNumber'] : '';
|
||||
|
||||
// correctexpo
|
||||
//$ev = isset($exif['EXIF']['ExposureBiasValue']) ? $exif['EXIF']['ExposureBiasValue'] : '';
|
||||
|
||||
if (isset($exif['EXIF']['ExposureBiasValue'])) {
|
||||
$ev = $exif['EXIF']['ExposureBiasValue'];
|
||||
$div = explode( "/", $ev);
|
||||
$dividende = $div[0];
|
||||
$diviseur = $div[1];
|
||||
|
||||
if (str_starts_with($ev, '0')) {
|
||||
$ev = '0';
|
||||
}
|
||||
elseif ($dividende === $diviseur) {
|
||||
$ev = '0';
|
||||
}
|
||||
if ((! str_starts_with($ev, '0')) && (! str_starts_with($ev, '-'))) {
|
||||
$ev = "+" . $ev;
|
||||
}
|
||||
} else {
|
||||
$ev = '';
|
||||
}
|
||||
|
||||
|
||||
// iso
|
||||
$iso = isset($exif['EXIF']['ISOSpeedRatings']) ? $exif['EXIF']['ISOSpeedRatings'] : '';
|
||||
|
||||
// model
|
||||
$mod = isset($exif['IFD0']['Model']) ? $exif['IFD0']['Model'] : '';
|
||||
|
||||
// metering
|
||||
if (isset($exif['EXIF']['MeteringMode'])) {
|
||||
$mm = $exif['EXIF']['MeteringMode'];
|
||||
|
||||
@@ -207,33 +269,70 @@ if ($d > 0) {
|
||||
$mm = '';
|
||||
}
|
||||
|
||||
// flash
|
||||
// https://stackoverflow.com/questions/7076958/read-exif-and-determine-if-the-flash-has-fired
|
||||
|
||||
if (isset($exif['EXIF']['Flash'])) {
|
||||
$fla = $exif['EXIF']['Flash'];
|
||||
|
||||
|
||||
$flash = $fla;
|
||||
//$flashfired = ($fla & 1) != 0;
|
||||
//echo "flashfired: " . $flashfired . "<br>";
|
||||
|
||||
// 12_2018.jpg No Flash 0
|
||||
// 5_2013.jpg Off, Did not fire 16
|
||||
// folder flash 9
|
||||
|
||||
switch ($fla) {
|
||||
case 0: $fla = gettext("Off");
|
||||
case 0: $fla = gettext("No Flash");
|
||||
break;
|
||||
case 1: $fla = gettext("Auto");
|
||||
case 9: $fla = gettext("On, Fired");
|
||||
break;
|
||||
case 2: $fla = gettext("On");
|
||||
break;
|
||||
case 3: $fla = gettext("Red Eye Reduction");
|
||||
break;
|
||||
case 4: $fla = gettext("Slow Synchro");
|
||||
break;
|
||||
case 5: $fla = gettext("Auto + Red Eye Reduction");
|
||||
break;
|
||||
case 6: $fla = gettext("On + Red Eye Reduction");
|
||||
break;
|
||||
case 16: $fla = gettext("External Flash");
|
||||
case 16: $fla = gettext("Off, Did not fire");
|
||||
break;
|
||||
default: $fla = gettext("Unknown");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Exiftool:
|
||||
[Flash] => On, Fired
|
||||
[Flash Compensation] => -1
|
||||
*/
|
||||
/*
|
||||
0x0 = No Flash
|
||||
0x1 = Fired
|
||||
0x5 = Fired, Return not detected
|
||||
0x7 = Fired, Return detected
|
||||
0x8 = On, Did not fire
|
||||
0x9 = On, Fired
|
||||
0xd = On, Return not detected
|
||||
0xf = On, Return detected
|
||||
0x10 = Off, Did not fire
|
||||
0x14 = Off, Did not fire, Return not detected
|
||||
0x18 = Auto, Did not fire
|
||||
0x19 = Auto, Fired
|
||||
0x1d = Auto, Fired, Return not detected
|
||||
0x1f = Auto, Fired, Return detected
|
||||
0x20 = No flash function
|
||||
0x30 = Off, No flash function
|
||||
0x41 = Fired, Red-eye reduction
|
||||
0x45 = Fired, Red-eye reduction, Return not detected
|
||||
0x47 = Fired, Red-eye reduction, Return detected
|
||||
0x49 = On, Red-eye reduction
|
||||
0x4d = On, Red-eye reduction, Return not detected
|
||||
0x4f = On, Red-eye reduction, Return detected
|
||||
0x50 = Off, Red-eye reduction
|
||||
0x58 = Auto, Did not fire, Red-eye reduction
|
||||
0x59 = Auto, Fired, Red-eye reduction
|
||||
0x5d = Auto, Fired, Red-eye reduction, Return not detected
|
||||
0x5f = Auto, Fired, Red-eye reduction, Return detected
|
||||
*/
|
||||
|
||||
} else {
|
||||
$fla = '';
|
||||
}
|
||||
|
||||
// focal
|
||||
if (isset($exif['EXIF']['FocalLength'])) {
|
||||
$k = explode('/', $exif['EXIF']['FocalLength']);
|
||||
$fl = $k[0] . " mm";
|
||||
@@ -241,7 +340,48 @@ if ($d > 0) {
|
||||
$fl = '';
|
||||
}
|
||||
|
||||
|
||||
// program
|
||||
if (isset($exif['EXIF']['ExposureMode'])) {
|
||||
$em = $exif['EXIF']['ExposureMode'];
|
||||
//$em = hexdec(intel2Moto($exif['EXIF']['ExposureMode']));
|
||||
//echo $em;
|
||||
|
||||
switch ($em) {
|
||||
case 0: $em = gettext("OFF");
|
||||
break;
|
||||
case 1: $em = gettext("ON");
|
||||
break;
|
||||
default: $em = gettext("Unknown");
|
||||
}
|
||||
|
||||
/*
|
||||
switch ($ep) {
|
||||
case 1: $ep = gettext('Manual');
|
||||
break;
|
||||
case 2: $ep = gettext('Program');
|
||||
break;
|
||||
case 3: $ep = gettext('Aperture Priority');
|
||||
break;
|
||||
case 4: $ep = gettext('Shutter Priority');
|
||||
break;
|
||||
case 5: $ep = gettext('Program Creative');
|
||||
break;
|
||||
case 6: $ep = gettext('Program Action');
|
||||
break;
|
||||
case 7: $ep = gettext('Portrait');
|
||||
break;
|
||||
case 8: $ep = gettext('Landscape');
|
||||
break;
|
||||
default: $ep = gettext('Unknown') . ': ' . $ep;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
} else {
|
||||
$em = '';
|
||||
}
|
||||
|
||||
// wb
|
||||
if (isset($exif['EXIF']['WhiteBalance'])) {
|
||||
$wb = $exif['EXIF']['WhiteBalance'];
|
||||
|
||||
@@ -273,6 +413,7 @@ if ($d > 0) {
|
||||
$wb = '';
|
||||
}
|
||||
|
||||
// mode
|
||||
if (isset($exif['EXIF']['ExposureProgram'])) {
|
||||
$ep = $exif['EXIF']['ExposureProgram'];
|
||||
|
||||
@@ -301,76 +442,137 @@ if ($d > 0) {
|
||||
$ep = '';
|
||||
}
|
||||
|
||||
// width
|
||||
$wi = isset($exif['COMPUTED']['Width']) ? $exif['COMPUTED']['Width'] : '';
|
||||
|
||||
// height
|
||||
$he = isset($exif['COMPUTED']['Height']) ? $exif['COMPUTED']['Height'] : '';
|
||||
|
||||
// html
|
||||
$ht = isset($exif['COMPUTED']['html']) ? $exif['COMPUTED']['html'] : '';
|
||||
$ap = isset($exif['COMPUTED']['ApertureFNumber']) ? $exif['COMPUTED']['ApertureFNumber'] : '';
|
||||
|
||||
|
||||
// software
|
||||
$soft = isset($exif['IFD0']['Software']) ? $exif['IFD0']['Software'] : '';
|
||||
|
||||
// lat, long, alt
|
||||
$gps = get_gps($exif);
|
||||
|
||||
// usercomment
|
||||
$uc = isset($exif['COMPUTED']['UserComment']) ? $exif['COMPUTED']['UserComment'] : '';
|
||||
|
||||
// comment
|
||||
$comment = isset($exif['COMMENT']['0']) ? $exif['COMMENT']['0'] : '';
|
||||
|
||||
|
||||
$photos[$i] = array(
|
||||
'filename' => $file,
|
||||
|
||||
'date' => $da,
|
||||
'filesize' => $fsize,
|
||||
'dateoriginal' => $da,
|
||||
|
||||
'lens' => $obj,
|
||||
'speed' => $sp,
|
||||
'aperture' => $ap,
|
||||
'correctexpo' => $ev, ////
|
||||
'iso' => $iso,
|
||||
|
||||
|
||||
'model' => $mod,
|
||||
'metering' => $mm,
|
||||
'flash' => $fla,
|
||||
'focal' => $fl,
|
||||
'program' => $em,
|
||||
'wb' => $wb,
|
||||
'mode' => $ep,
|
||||
|
||||
'width' => $wi,
|
||||
'height' => $he,
|
||||
'html' => $ht,
|
||||
'aperture' => $ap,
|
||||
|
||||
'model' => $mod,
|
||||
'software' => $soft,
|
||||
|
||||
'lat' => $gps['latitude'],
|
||||
'long' => $gps['longitude'],
|
||||
'alt' => $gps['altitude'],
|
||||
|
||||
'metering' => $mm,
|
||||
'flash' => $fla,
|
||||
'focal' => $fl,
|
||||
'wb' => $wb,
|
||||
'program' => $ep
|
||||
'usercomment' => $uc,
|
||||
'comment' => $comment,
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
/********/
|
||||
/* IPTC */
|
||||
/********/
|
||||
|
||||
if ($iptc = @getimagesize($file, $info)) {
|
||||
//_pr($iptc);
|
||||
|
||||
if (isset($info["APP13"])) {
|
||||
$mots = "";
|
||||
$iptc = iptcparse ($info["APP13"]);
|
||||
$legende = (isset($iptc["2#120"][0])) ? $iptc["2#120"][0] : '';
|
||||
$copyright = (isset($iptc["2#116"][0])) ? $iptc["2#116"][0] : '';
|
||||
$title = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : '';
|
||||
$creator = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : '';
|
||||
$mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : '';
|
||||
$iptc = iptcparse ($info["APP13"]);
|
||||
|
||||
// keywords
|
||||
$mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : '';
|
||||
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]['title'] = $title;
|
||||
$photos[$i]['creator'] = $creator;
|
||||
$photos[$i]['mots_cles'] = $mots;
|
||||
|
||||
// titre
|
||||
$title = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : '';
|
||||
|
||||
// creator
|
||||
$creator = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : '';
|
||||
|
||||
// ville
|
||||
$ville = (isset($iptc["2#090"][0])) ? $iptc["2#090"][0] : '';
|
||||
|
||||
// departement
|
||||
$departement = (isset($iptc["2#095"][0])) ? $iptc["2#095"][0] : '';
|
||||
|
||||
// code
|
||||
$code = (isset($iptc["2#100"][0])) ? $iptc["2#100"][0] : '';
|
||||
|
||||
// pays
|
||||
$pays = (isset($iptc["2#101"][0])) ? $iptc["2#101"][0] : '';
|
||||
|
||||
// copyright
|
||||
$copyright = (isset($iptc["2#116"][0])) ? $iptc["2#116"][0] : '';
|
||||
|
||||
// legende
|
||||
$legende = (isset($iptc["2#120"][0])) ? $iptc["2#120"][0] : '';
|
||||
|
||||
|
||||
$photos[$i]['keywords'] = $mots;
|
||||
$photos[$i]['title'] = $title;
|
||||
$photos[$i]['creator'] = $creator;
|
||||
|
||||
$photos[$i]['city'] = $ville;
|
||||
$photos[$i]['department'] = $departement;
|
||||
$photos[$i]['code'] = $code;
|
||||
$photos[$i]['country'] = $pays;
|
||||
|
||||
$photos[$i]['copyright'] = $copyright;
|
||||
$photos[$i]['legende'] = $legende;
|
||||
|
||||
}
|
||||
else {
|
||||
$photos[$i]['legende'] = '';
|
||||
$photos[$i]['copyright'] = '';
|
||||
$photos[$i]['keywords'] = '';
|
||||
$photos[$i]['title'] = '';
|
||||
$photos[$i]['creator'] = '';
|
||||
$photos[$i]['mots_cles'] = '';
|
||||
$photos[$i]['city'] = '';
|
||||
$photos[$i]['department'] = '';
|
||||
$photos[$i]['code'] = '';
|
||||
$photos[$i]['country'] = '';
|
||||
$photos[$i]['copyright'] = '';
|
||||
$photos[$i]['legende'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
//_pr($photos);
|
||||
|
||||
$query5 = "SELECT MAX(id) FROM photos";
|
||||
$stmt = $conn->prepare($query5);
|
||||
@@ -382,63 +584,83 @@ if ($d > 0) {
|
||||
|
||||
|
||||
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, filesize, dateoriginal, lens, speed, aperture, correctexpo, iso, model, metering, flash, focal, program, wb, mode, width, height, html, software, lat, long, alt, usercomment, comment, keywords, title, creator, city, department, code, country, copyright, legende) VALUES (:filename, :filesize, :dateoriginal, :lens, :speed, :aperture, :correctexpo, :iso, :model, :metering, :flash, :focal, :program, :wb, :mode, :width, :height, :html, :software, :lat, :long, :alt, :usercomment, :comment, :keywords, :title, :creator, :city, :department, :code, :country, :copyright, :legende)";
|
||||
|
||||
$stmt = $conn->prepare($query2);
|
||||
|
||||
/* EXIF */
|
||||
$stmt->bindParam(':filename', $file);
|
||||
$stmt->bindParam(':date', $da);
|
||||
$stmt->bindParam(':filesize', $fsize);
|
||||
$stmt->bindParam(':dateoriginal', $da);
|
||||
$stmt->bindParam(':lens', $obj);
|
||||
$stmt->bindParam(':speed', $sp);
|
||||
$stmt->bindParam(':iso', $iso);
|
||||
$stmt->bindParam(':width', $wi);
|
||||
$stmt->bindParam(':height', $he);
|
||||
$stmt->bindParam(':html', $ht);
|
||||
$stmt->bindParam(':aperture', $ap);
|
||||
$stmt->bindParam(':correctexpo', $ev);
|
||||
$stmt->bindParam(':iso', $iso);
|
||||
$stmt->bindParam(':model', $mod);
|
||||
$stmt->bindParam(':lat', $gps['latitude']);
|
||||
$stmt->bindParam(':long', $gps['longitude']);
|
||||
$stmt->bindParam(':alt', $gps['altitude']);
|
||||
|
||||
$stmt->bindParam(':legende', $leg);
|
||||
$stmt->bindParam(':copyright', $cop);
|
||||
$stmt->bindParam(':title', $tit);
|
||||
$stmt->bindParam(':creator', $crea);
|
||||
$stmt->bindParam(':keywords', $mot);
|
||||
|
||||
$stmt->bindParam(':metering', $mm);
|
||||
$stmt->bindParam(':flash', $fla);
|
||||
$stmt->bindParam(':focal', $fl);
|
||||
$stmt->bindParam(':program', $em);
|
||||
$stmt->bindParam(':wb', $wb);
|
||||
$stmt->bindParam(':program', $ep);
|
||||
$stmt->bindParam(':mode', $ep);
|
||||
$stmt->bindParam(':width', $wi);
|
||||
$stmt->bindParam(':height', $he);
|
||||
$stmt->bindParam(':html', $ht);
|
||||
$stmt->bindParam(':software', $soft);
|
||||
$stmt->bindParam(':lat', $gps['latitude']);
|
||||
$stmt->bindParam(':long', $gps['longitude']);
|
||||
$stmt->bindParam(':alt', $gps['altitude']);
|
||||
$stmt->bindParam(':usercomment', $uc);
|
||||
$stmt->bindParam(':comment', $com);
|
||||
|
||||
/* IPTC */
|
||||
$stmt->bindParam(':keywords', $mot);
|
||||
$stmt->bindParam(':title', $tit);
|
||||
$stmt->bindParam(':creator', $crea);
|
||||
$stmt->bindParam(':city', $ci);
|
||||
$stmt->bindParam(':department', $dep);
|
||||
$stmt->bindParam(':code', $cp);
|
||||
$stmt->bindParam(':country', $pa);
|
||||
$stmt->bindParam(':copyright', $cop);
|
||||
$stmt->bindParam(':legende', $leg);
|
||||
|
||||
|
||||
if (isset($photos)) {
|
||||
foreach ($photos as $item) {
|
||||
$file = $item['filename'];
|
||||
$da = $item['date'];
|
||||
$fsize = $item['filesize'];
|
||||
$da = $item['dateoriginal'];
|
||||
$obj = $item['lens'];
|
||||
$sp = $item['speed'];
|
||||
$iso = $item['iso'];
|
||||
$wi = $item['width'];
|
||||
$he = $item['height'];
|
||||
$ht = $item['html'];
|
||||
$ap = $item['aperture'];
|
||||
$ev = $item['correctexpo'];
|
||||
$iso = $item['iso'];
|
||||
$mod = $item['model'];
|
||||
$gps['latitude'] = $item['lat'];
|
||||
$gps['longitude'] = $item['long'];
|
||||
$gps['altitude'] = $item['alt'];
|
||||
|
||||
$leg = $item['legende'];
|
||||
$cop = $item['copyright'];
|
||||
$tit = $item['title'];
|
||||
$crea = $item['creator'];
|
||||
$mot = $item['mots_cles'];
|
||||
|
||||
$mm = $item['metering'];
|
||||
$fla = $item['flash'];
|
||||
$fl = $item['focal'];
|
||||
$em = $item['program'];
|
||||
$wb = $item['wb'];
|
||||
$ep = $item['program'];
|
||||
$ep = $item['mode'];
|
||||
$wi = $item['width'];
|
||||
$he = $item['height'];
|
||||
$ht = $item['html'];
|
||||
$soft = $item['software'];
|
||||
$gps['latitude'] = $item['lat'];
|
||||
$gps['longitude'] = $item['long'];
|
||||
$gps['altitude'] = $item['alt'];
|
||||
$mot = $item['keywords'];
|
||||
$tit = $item['title'];
|
||||
$crea = $item['creator'];
|
||||
$ci = $item['city'];
|
||||
$dep = $item['department'];
|
||||
$cp = $item['code'];
|
||||
$pa = $item['country'];
|
||||
$cop = $item['copyright'];
|
||||
$leg = $item['legende'];
|
||||
$uc = $item['usercomment'];
|
||||
$com = $item['comment'];
|
||||
|
||||
create_thumb($th_w, $th_h, $file);
|
||||
|
||||
@@ -451,8 +673,13 @@ if ($d > 0) {
|
||||
}
|
||||
|
||||
|
||||
/***********************/
|
||||
/* Display new entries */
|
||||
/***********************/
|
||||
|
||||
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, filesize, dateoriginal, lens, speed, aperture, correctexpo, iso, model, metering, flash, focal, program, wb, mode, width, height, html, software, lat, long, alt, usercomment, comment, keywords, title, creator, city, department, code, country, copyright, legende FROM photos WHERE id > ? ORDER BY dateoriginal DESC";
|
||||
|
||||
$stmt = $conn->prepare($query4);
|
||||
$stmt->bindValue(1, $nb_avant, SQLITE3_INTEGER); // (1,3...) 1=1ere valeur 3=valeur
|
||||
@@ -462,16 +689,16 @@ if ($d > 0) {
|
||||
echo '<div id="add_to_bdd">';
|
||||
echo '<table class="styled-table">';
|
||||
echo '<thead>';
|
||||
echo '<th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('Date') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Width') . '</th><th>' . gettext('Height') . '</th><th>' . gettext('Html') . '</th>';
|
||||
echo '<th>' . gettext('Aperture') . '</th><th>' . gettext('Model') . '</th><th>' . gettext('Latitude') . '</th><th>' . gettext('Longitude') . '</th><th>' . gettext('Alttitude') . '</th><th>' . gettext('Legende') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Title') . '</th>';
|
||||
echo '<th>' . gettext('Creator') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Flash') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Wb') . '</th><th>' . gettext('Program') . '</th>';
|
||||
echo '<th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('File size') . '</th><th>' . gettext('Date') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Speed') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Exposure Corr.') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Model') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Flash') . '</th>';
|
||||
echo '<th>' . gettext('Focal') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('White Balance') . '</th><th>' . gettext('Mode') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Latitude') . '</th><th>' . gettext('Longitude') . '</th><th>' . gettext('Alttitude') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th>';
|
||||
echo '<th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('CP') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</th>';
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$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['filesize'] . '</td><td>' . $row['dateoriginal'] . '</td><td>' . $row['lens'] . '</td><td>' . $row['speed'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['model'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['flash'] . '</td><td>' . $row['focal'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td><td>' . $row['mode'] . '</td><td>' . $row['software'] . '</td><td>' . $row['lat'] . '</td><td>' . $row['long'] . '</td><td>' . $row['alt'] . '</td><td>' . $row['keywords'] . '</td><td>' . $row['title'] . '</td><td>' . $row['creator'] . '</td><td>' . $row['city'] . '</td><td>' . $row['department'] . '</td><td>' . $row['code'] . '</td><td>' . $row['country'] . '</td><td>' . $row['copyright'] . '</td><td>' . $row['legende'] . '</td></tr>';
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
echo '</div>';
|
||||
@@ -491,12 +718,12 @@ if ($d > 0) {
|
||||
|
||||
?>
|
||||
|
||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="admin/index.php" title="<?php echo gettext("Admin"); ?>"><?php echo gettext("Admin"); ?></a></p>
|
||||
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
|
||||
|
||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||
<p><em><small>© 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
|
||||
|
||||
<script src='js/lc_lightbox.min.js' type='text/javascript'></script>
|
||||
<script src='js/alloy_finger.min.js' type='text/javascript'></script>
|
||||
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
|
||||
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user