Files
sls/_test/ev.php
2024-12-10 11:19:38 +01:00

76 lines
1.6 KiB
PHP

<?php
include 'functions.php';
/* ------------- */
/* Create thumbs */
/* ------------- */
?>
<!DOCTYPE html>
<html lang="en">
<head>
<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>
<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' />
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
</head>
<body>
<?php
$dir = (new AdvancedFilesystemIterator('photos/img/'))->match('/heic|HEIC|jpg|jpeg|JPG|JPEG|webp|WEBP|avif|AVIF$/');
//print_r($dir);
$i = 1;
$photos = array();
foreach($dir as $file){
$file = $file->getpathName();
/**/
if ($exif = @exif_read_data($file, 0, true )) {
//_pr($exif);
$ev = isset($exif['EXIF']['ExposureBiasValue']) ? $exif['EXIF']['ExposureBiasValue'] : '';
//echo $ev . "<br>";
//echo strlen($ev). "<br>";
$div = explode( "/", $ev);
$dividende = $div[0];
$diviseur = $div[1];
echo $dividende .PHP_EOL;
echo $diviseur .PHP_EOL;
if (str_starts_with($ev, '0')) {
$ev = '0';
}
elseif ($dividende === $diviseur) {
$ev = '0';
}
echo "---<br>";
if ((! str_starts_with($ev, '0')) && (! str_starts_with($ev, '-'))) {
$ev = "+" . $ev;
}
$photos[$file] = $ev;
}
}
_pr($photos);
?>
</body>
</html>