Mise-à-jour sur-le-sentier.fr
version 2
This commit is contained in:
545
insert_bdd.php
545
insert_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,77 +11,90 @@
|
||||
<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('Insert photos in Sqlite base'); ?></title>
|
||||
<title><?php echo gettext('Insert 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.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
$base = 'db_photo.sqlite3';
|
||||
|
||||
echo '<h1>' . gettext("Insert images in " . $base . " database.") . '</h1><br />';
|
||||
|
||||
if (file_exists($base)) {
|
||||
echo '<h3 class="redstyle">Database ' . $base . ' already exist! Delete it !<h3>';
|
||||
unlink($base);
|
||||
}
|
||||
|
||||
// Taille des vignettes
|
||||
$th_w = 300;
|
||||
$th_h = 300;
|
||||
|
||||
$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>';
|
||||
echo '<h3>' . count($dir) . gettext(' images found in folder') . ' <i><a href="photos/img/">photos/img/</a></i> ...</h3>';
|
||||
|
||||
echo '<h3>' . gettext("Creation of the database") . ' <i>' . $base . '</i> ' . gettext("and the table") . ' <i>photo</i> (' . gettext("if necessary") . ')...</h3>';
|
||||
|
||||
// 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);
|
||||
$query = "CREATE TABLE IF NOT EXISTS photos (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
filename TEXT NOT NULL,
|
||||
dateoriginal TEXT,
|
||||
lens TEXT,
|
||||
speed TEXT,
|
||||
iso INTEGER,
|
||||
width INTEGER,
|
||||
height INTEGER,
|
||||
html TEXT,
|
||||
aperture TEXT,
|
||||
model TEXT,
|
||||
lat REAL,
|
||||
long REAL,
|
||||
alt REAL,
|
||||
legende TEXT,
|
||||
copyright TEXT,
|
||||
title TEXT,
|
||||
creator TEXTr,
|
||||
keywords TEXT,
|
||||
metering TEXT,
|
||||
flash TEXT,
|
||||
focal TEXT,
|
||||
wb TEXT,
|
||||
program TEXT,
|
||||
UNIQUE(filename)
|
||||
)";
|
||||
$conn->exec($query);
|
||||
try {
|
||||
|
||||
echo '<h3>' . gettext('Read image files in the folder') . ' <i>photos/img/</i>...</h3>';
|
||||
// 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);
|
||||
$query = "CREATE TABLE IF NOT EXISTS photos (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
filename TEXT NOT NULL,
|
||||
filesize TEXT,
|
||||
dateoriginal TEXT,
|
||||
lens TEXT,
|
||||
speed TEXT,
|
||||
correctexpo TEXT,
|
||||
iso INTEGER,
|
||||
usercomment TEXT,
|
||||
comment TEXT,
|
||||
model TEXT,
|
||||
metering TEXT,
|
||||
flash TEXT,
|
||||
focal TEXT,
|
||||
program TEXT,
|
||||
wb TEXT,
|
||||
mode TEXT,
|
||||
width INTEGER,
|
||||
height INTEGER,
|
||||
html TEXT,
|
||||
aperture TEXT,
|
||||
software TEXT,
|
||||
lat TEXT,
|
||||
long TEXT,
|
||||
alt TEXT,
|
||||
keywords TEXT,
|
||||
title TEXT,
|
||||
creator TEXT,
|
||||
city TEXT,
|
||||
department TEXT,
|
||||
code TEXT,
|
||||
country TEXT,
|
||||
copyright TEXT,
|
||||
legende TEXT,
|
||||
UNIQUE(filename)
|
||||
)";
|
||||
// 33 entrées
|
||||
|
||||
$conn->exec($query);
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
echo '<h3>' . gettext('Read image files in the folder') . ' <i><a href="photos/img/">photos/img/</a></i>...</h3>';
|
||||
|
||||
$i = 1;
|
||||
$photos = array();
|
||||
@@ -87,26 +106,40 @@ foreach($dir as $file){
|
||||
*/
|
||||
$file = $file->getpathName();
|
||||
$x = in_bdd($file);
|
||||
|
||||
|
||||
/*
|
||||
if ($i > 5) {
|
||||
break;
|
||||
}
|
||||
*/
|
||||
// https://exiftool.org/TagNames/EXIF.html
|
||||
// https://exiftool.org/TagNames/Canon.html
|
||||
|
||||
if ($x == false) { //false
|
||||
|
||||
if ($exif = @exif_read_data($file, 0, true )) {
|
||||
|
||||
//_pr($exif);
|
||||
|
||||
unset($fla);
|
||||
unset($flash);
|
||||
|
||||
$fs = isset($exif['FILE']['FileSize']) ? $exif['FILE']['FileSize'] : '';
|
||||
$fsize = formatBytes($fs, $precision = 0);
|
||||
|
||||
$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']['DateTimeOriginal'])) {
|
||||
$d = explode(' ', $exif['EXIF']['DateTimeOriginal']);
|
||||
$da = str_replace(':', '-', $d[0]) . " " . $d[1] . ".000";
|
||||
} else {
|
||||
$d = '';
|
||||
$da = '';
|
||||
}
|
||||
|
||||
if (isset($exif['EXIF']['UndefinedTag:0xA434'])) {
|
||||
$w = $exif['EXIF']['UndefinedTag:0xA434'];
|
||||
$w = trim($exif['EXIF']['UndefinedTag:0xA434']);
|
||||
|
||||
$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 ");
|
||||
$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;
|
||||
@@ -122,8 +155,28 @@ foreach($dir as $file){
|
||||
$sp = '';
|
||||
}
|
||||
|
||||
|
||||
$ev = isset($exif['EXIF']['ExposureBiasValue']) ? $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;
|
||||
}
|
||||
|
||||
$iso = isset($exif['EXIF']['ISOSpeedRatings']) ? $exif['EXIF']['ISOSpeedRatings'] : '';
|
||||
|
||||
$uc = isset($exif['COMPUTED']['UserComment']) ? $exif['COMPUTED']['UserComment'] : '';
|
||||
$comment = isset($exif['COMMENT']['0']) ? $exif['COMMENT']['0'] : '';
|
||||
|
||||
$mod = isset($exif['IFD0']['Model']) ? $exif['IFD0']['Model'] : '';
|
||||
|
||||
if (isset($exif['EXIF']['MeteringMode'])) {
|
||||
$mm = $exif['EXIF']['MeteringMode'];
|
||||
|
||||
@@ -154,29 +207,64 @@ foreach($dir as $file){
|
||||
$mm = '';
|
||||
}
|
||||
|
||||
// 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 = '';
|
||||
}
|
||||
@@ -188,33 +276,34 @@ foreach($dir as $file){
|
||||
$fl = '';
|
||||
}
|
||||
|
||||
/*
|
||||
if (isset($exif['EXIF']['ExposureMode'])) {
|
||||
$em = $exif['EXIF']['ExposureMode'];
|
||||
echo $em;
|
||||
$em = hexdec(intel2Moto($exif['EXIF']['ExposureMode']));
|
||||
echo $em;
|
||||
|
||||
switch ($em) {
|
||||
case 0: $em = gettext("EasyShoot");
|
||||
if (isset($exif['EXIF']['ExposureProgram'])) {
|
||||
$ep = $exif['EXIF']['ExposureProgram']; // 0
|
||||
|
||||
switch ($ep) {
|
||||
case 0: $ep = gettext("EasyShoot");
|
||||
break;
|
||||
case 1: $em = gettext("Program");
|
||||
case 1: $ep = gettext("Program");
|
||||
break;
|
||||
case 2: $em = gettext("Tv");
|
||||
case 2: $ep = gettext("Tv (Shutter speed priority)");
|
||||
break;
|
||||
case 3: $em = gettext("Av");
|
||||
case 3: $ep = gettext("Av (Aperture-priority)");
|
||||
break;
|
||||
case 4: $em = gettext("Manual");
|
||||
case 4: $ep = gettext("Manual");
|
||||
break;
|
||||
case 5: $em = gettext("Auto-DEP");
|
||||
case 5: $ep = gettext("Auto-DEP");
|
||||
break;
|
||||
default: $em = gettext("Unknown");
|
||||
case 6: $ep = gettext("M-DEP");
|
||||
break;
|
||||
case 7: $ep = gettext("Bulb");
|
||||
break;
|
||||
case 8: $ep = gettext("F (Flexible-priority)");
|
||||
break;
|
||||
default: $ep = gettext("Unknown");
|
||||
}
|
||||
|
||||
} else {
|
||||
$em = '';
|
||||
$ep = '';
|
||||
}
|
||||
*/
|
||||
|
||||
if (isset($exif['EXIF']['WhiteBalance'])) {
|
||||
$wb = $exif['EXIF']['WhiteBalance'];
|
||||
@@ -242,13 +331,25 @@ foreach($dir as $file){
|
||||
break;
|
||||
default: $wb = gettext("Unknown");
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$wb = '';
|
||||
}
|
||||
if (isset($exif['EXIF']['ExposureProgram'])) {
|
||||
$ep = $exif['EXIF']['ExposureProgram'];
|
||||
|
||||
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;
|
||||
@@ -266,89 +367,160 @@ foreach($dir as $file){
|
||||
break;
|
||||
case 8: $ep = gettext('Landscape');
|
||||
break;
|
||||
default: $ep = gettext('Unknown') . ': ' . $data;
|
||||
default: $ep = gettext('Unknown') . ': ' . $ep;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
} else {
|
||||
$ep = '';
|
||||
$em = '';
|
||||
}
|
||||
|
||||
$wi = isset($exif['COMPUTED']['Width']) ? $exif['COMPUTED']['Width'] : '';
|
||||
$he = isset($exif['COMPUTED']['Height']) ? $exif['COMPUTED']['Height'] : '';
|
||||
$ht = isset($exif['COMPUTED']['html']) ? $exif['COMPUTED']['html'] : '';
|
||||
$ap = isset($exif['COMPUTED']['ApertureFNumber']) ? $exif['COMPUTED']['ApertureFNumber'] : '';
|
||||
|
||||
$soft = isset($exif['IFD0']['Software']) ? $exif['IFD0']['Software'] : '';
|
||||
|
||||
$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,
|
||||
|
||||
'filesize' => $fsize,
|
||||
|
||||
'dateoriginal' => $da,
|
||||
'lens' => $obj,
|
||||
'speed' => $sp,
|
||||
'correctexpo' => $ev,
|
||||
'iso' => $iso,
|
||||
|
||||
'usercomment' => $uc,
|
||||
'comment' => $comment,
|
||||
'model' => $mod,
|
||||
|
||||
'metering' => $mm,
|
||||
'flash' => $fla,
|
||||
'focal' => $fl,
|
||||
|
||||
'program' => $ep,
|
||||
'wb' => $wb,
|
||||
'mode' => $em,
|
||||
|
||||
'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
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
if ($iptc = @getimagesize($file, $info)) {
|
||||
//_pr($iptc);
|
||||
|
||||
//zz = iptcparse($info['APP1']);
|
||||
//_pr(zz);
|
||||
//$ww = iptcparse($info['8BIM']);
|
||||
//_pr(ww);
|
||||
|
||||
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"] : ''; // array
|
||||
//_pr($iptc);
|
||||
/*
|
||||
'2#005'=>'DocumentTitle',
|
||||
'2#010'=>'Urgency',
|
||||
'2#015'=>'Category',
|
||||
'2#020'=>'Subcategories',
|
||||
'2#040'=>'SpecialInstructions',
|
||||
'2#055'=>'CreationDate', 20240619
|
||||
'2#080'=>'AuthorByline',
|
||||
'2#085'=>'AuthorTitle',
|
||||
'2#090'=>'City',
|
||||
'2#095'=>'State',
|
||||
'2#101'=>'Country',
|
||||
'2#103'=>'OTR',
|
||||
'2#105'=>'Headline',
|
||||
'2#110'=>'Source',
|
||||
'2#115'=>'PhotoSource',
|
||||
'2#116'=>'Copyright',
|
||||
'2#120'=>'Caption',
|
||||
'2#122'=>'CaptionWriter'
|
||||
|
||||
'1#090'=>'CodedCharacterSet' %G
|
||||
'2#060' 200514+0200
|
||||
'2#062' 20240619
|
||||
'2#063' 200514+0200
|
||||
*/
|
||||
$mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : ''; // array - ok
|
||||
if (!empty($mots_cles)) {
|
||||
foreach ($mots_cles as $key => $val) {
|
||||
$mots .= strtolower($val) . ",";
|
||||
}
|
||||
$mots = substr($mots, 0, -1);
|
||||
}
|
||||
|
||||
$photos[$i]['legende'] = $legende;
|
||||
$titre = (isset($iptc["2#005"][0])) ? $iptc["2#005"][0] : ''; // ok
|
||||
$creator = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : ''; //ok
|
||||
//$AuthorTitle = (isset($iptc["2#085"][0])) ? $iptc["2#085"][0] : '';
|
||||
$ville = (isset($iptc["2#090"][0])) ? $iptc["2#090"][0] : ''; //ok
|
||||
$departement = (isset($iptc["2#095"][0])) ? $iptc["2#095"][0] : ''; //ok
|
||||
$code = (isset($iptc["2#100"][0])) ? $iptc["2#100"][0] : ''; //ok
|
||||
$pays = (isset($iptc["2#101"][0])) ? $iptc["2#101"][0] : ''; //ok
|
||||
//$title = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : '';
|
||||
$copyright = (isset($iptc["2#116"][0])) ? $iptc["2#116"][0] : ''; //ok
|
||||
$legende = (isset($iptc["2#120"][0])) ? $iptc["2#120"][0] : ''; //ok
|
||||
|
||||
/*
|
||||
_pr($mots_cles); // ok
|
||||
echo $city . "<br />"; //ok
|
||||
echo $creator . "<br />"; // ok
|
||||
echo $AuthorTitle . "<br />";
|
||||
echo $ville . "<br />"; //ok
|
||||
echo $departement . "<br />"; //ok
|
||||
echo $code . "<br />";
|
||||
echo $pays . "<br />"; //ok
|
||||
echo $title . "<br />"; //ok
|
||||
echo $copyright . "<br />";
|
||||
echo $legende . "<br />";
|
||||
*/
|
||||
|
||||
$photos[$i]['keywords'] = $mots;
|
||||
$photos[$i]['title'] = $titre;
|
||||
$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]['title'] = $title;
|
||||
$photos[$i]['creator'] = $creator;
|
||||
$photos[$i]['mots_cles'] = $mots;
|
||||
$photos[$i]['legende'] = $legende;
|
||||
}
|
||||
/*
|
||||
else {
|
||||
$photos[$i]['legende'] = '';
|
||||
$photos[$i]['mots_cles'] = '';
|
||||
$photos[$i]['titre'] = '';
|
||||
$photos[$i]['creator'] = '';
|
||||
$photos[$i]['ville'] = '';
|
||||
$photos[$i]['departement'] = '';
|
||||
$photos[$i]['code'] = '';
|
||||
$photos[$i]['pays'] = '';
|
||||
$photos[$i]['copyright'] = '';
|
||||
$photos[$i]['title'] = '';
|
||||
$photos[$i]['creator'] = '';
|
||||
$photos[$i]['mots_cles'] = '';
|
||||
$photos[$i]['legende'] = '';
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
// _pr($photos);
|
||||
|
||||
|
||||
$z = count($photos);
|
||||
if ($z == 0) {
|
||||
echo '<h3>' . gettext('No new image files to add') . '...</h3>';
|
||||
@@ -357,6 +529,8 @@ if ($z == 0) {
|
||||
die();
|
||||
}
|
||||
|
||||
//_pr($photos);
|
||||
|
||||
$query5 = "SELECT MAX(id) FROM photos";
|
||||
$stmt = $conn->prepare($query5);
|
||||
$stmt->execute();
|
||||
@@ -366,7 +540,7 @@ $avant = $resultat['MAX(id)'];
|
||||
$nb_avant = (isset($avant)) ? $avant : 0;
|
||||
|
||||
|
||||
echo '<h3>' . gettext('Creation of thumbnails') . ' ('. $th_w . 'px x ' . $th_h . 'px) ' . gettext('in the folder') . ' <i>photos/thumb/</i>.</h3>';
|
||||
echo '<h3>' . gettext('Creation of thumbnails') . ' ('. $th_w . 'px x ' . $th_h . 'px) ' . gettext('in the folder') . ' <i><a href="photos/img/">photos/thumb/</a></i>.</h3>';
|
||||
|
||||
$b = ($z > 1) ? gettext('new images') : gettext('new image');
|
||||
echo '<h3>' . gettext('Insertion of ') . $z . ' ' . $b . gettext(' in database') . '...</h3>';
|
||||
@@ -374,69 +548,100 @@ 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, 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)";
|
||||
$query2 = "INSERT OR IGNORE INTO photos (filename, filesize, dateoriginal, lens, speed, correctexpo, iso, usercomment, comment, model, metering, flash, focal, program, wb, mode, width, height, html, aperture, software, lat, long, alt, keywords, title, creator, city, department, code, country, copyright, legende)
|
||||
VALUES (:filename, :filesize, :dateoriginal, :lens, :speed, :correctexpo, :iso, :usercomment, :comment, :model, :metering, :flash, :focal, :program, :wb, :mode, :width, :height, :html, :aperture, :software, :lat, :long, :alt, :keywords, :title, :creator, :city, :department, :code, :country, :copyright, :legende)";
|
||||
|
||||
$stmt = $conn->prepare($query2);
|
||||
$stmt->bindParam(':filename', $file);
|
||||
$stmt->bindParam(':filesize', $fsize);
|
||||
$stmt->bindParam(':dateoriginal', $da);
|
||||
$stmt->bindParam(':lens', $obj);
|
||||
$stmt->bindParam(':speed', $sp);
|
||||
$stmt->bindParam(':correctexpo', $ev);
|
||||
$stmt->bindParam(':iso', $iso);
|
||||
$stmt->bindParam(':width', $wi);
|
||||
$stmt->bindParam(':height', $he);
|
||||
$stmt->bindParam(':html', $ht);
|
||||
$stmt->bindParam(':aperture', $ap);
|
||||
|
||||
$stmt->bindParam(':usercomment', $uc);
|
||||
$stmt->bindParam(':comment', $comment);
|
||||
$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(':wb', $wb);
|
||||
$stmt->bindParam(':program', $ep);
|
||||
$stmt->bindParam(':wb', $wb);
|
||||
$stmt->bindParam(':mode', $em);
|
||||
|
||||
$stmt->bindParam(':width', $wi);
|
||||
$stmt->bindParam(':height', $he);
|
||||
$stmt->bindParam(':html', $ht);
|
||||
$stmt->bindParam(':aperture', $ap);
|
||||
$stmt->bindParam(':software', $soft);
|
||||
|
||||
$stmt->bindParam(':lat', $gps['latitude']);
|
||||
$stmt->bindParam(':long', $gps['longitude']);
|
||||
$stmt->bindParam(':alt', $gps['altitude']);
|
||||
|
||||
$stmt->bindParam(':keywords', $mots);
|
||||
$stmt->bindParam(':title', $titre);
|
||||
$stmt->bindParam(':creator', $creator);
|
||||
$stmt->bindParam(':city', $ville);
|
||||
$stmt->bindParam(':department', $departement);
|
||||
$stmt->bindParam(':code',$code);
|
||||
$stmt->bindParam(':country',$pays);
|
||||
$stmt->bindParam(':copyright', $copyright);
|
||||
$stmt->bindParam(':legende', $legende);
|
||||
|
||||
|
||||
if (isset($photos)) {
|
||||
|
||||
//_pr($photos);
|
||||
|
||||
foreach ($photos as $item) {
|
||||
$file = $item['filename'];
|
||||
$da = $item['dateoriginal'];
|
||||
$obj = $item['lens'];
|
||||
$sp = $item['speed'];
|
||||
$iso = $item['iso'];
|
||||
$wi = $item['width'];
|
||||
$he = $item['height'];
|
||||
$ht = $item['html'];
|
||||
$ap = $item['aperture'];
|
||||
$mod = $item['model'];
|
||||
$gps['latitude'] = $item['lat'];
|
||||
$gps['longitude'] = $item['long'];
|
||||
$gps['altitude'] = $item['alt'];
|
||||
$file = $item['filename']; // *** photos/img/3_2023.jpg
|
||||
$fsize = $item['filesize']; // 232 Ko
|
||||
$da = $item['dateoriginal']; // *** 2023-03-04 10:05:25.000
|
||||
$obj = $item['lens']; // *** EF600mm f/4L IS III USM +1.4x III
|
||||
$sp = $item['speed']; // *** 1/3200
|
||||
$ev = $item['correctexpo']; // -1/3
|
||||
$iso = $item['iso']; // *** 800
|
||||
|
||||
$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'];
|
||||
$wb = $item['wb'];
|
||||
$ep = $item['program'];
|
||||
|
||||
$uc = $item['usercomment'];
|
||||
$comment = $item['comment']; // Optimized by JPEGmini 3.18.9.220874607-AV 0x21824209
|
||||
$mod = $item['model']; // *** Canon EOS R7
|
||||
|
||||
$mm = $item['metering']; // *** Mesure évaluative
|
||||
$fla = $item['flash']; // Off
|
||||
$fl = $item['focal']; // *** 840 mm
|
||||
$ep = $item['program']; // Av (Priorité ouverture)
|
||||
$wb = $item['wb']; // *** Lumière du jour
|
||||
$em = $item['mode']; // OFF
|
||||
|
||||
$wi = $item['width']; // 1600
|
||||
$he = $item['height']; // 1067
|
||||
$ht = $item['html']; // width="1600" height="1067"
|
||||
$ap = $item['aperture']; // *** f/6.3
|
||||
$soft = $item['software']; // Adobe Photoshop Lightroom Classic 12.2.1 (Macintosh)
|
||||
|
||||
$gps['latitude'] = $item['lat']; // *** 47.169489533333
|
||||
$gps['longitude'] = $item['long']; // *** 4.7472749
|
||||
$gps['altitude'] = $item['alt']; // *** 492
|
||||
|
||||
$mots = $item['keywords']; // *** falco peregrinus,falconidés,falconiformes,faucon pèlerin,oiseaux,_vert_,falaise,femelle
|
||||
$creator = $item['creator']; // Pesenti
|
||||
$ville = $item['city']; // Antheuil
|
||||
$departement = $item['department']; // Côte-d'Or
|
||||
$code = $item['code']; // FR
|
||||
$pays = $item['country']; // France
|
||||
$copyright = $item['copyright']; // clicclac.info
|
||||
$titre = $item['title']; // ***
|
||||
$legende = $item['legende']; // ***
|
||||
|
||||
create_thumb($th_w, $th_h, $file);
|
||||
|
||||
$stmt->execute();
|
||||
}
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
@@ -502,12 +707,12 @@ try {
|
||||
});
|
||||
</script>
|
||||
|
||||
<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