[EXIF reading] - patch of problem for reading data

comment of lines which calculate the good focal length and the F-number to avoid division by zero
use of a elseif to take into account the EXIF readen in the caption of the image
rework of the syntax to pend exif info to caption
This commit is contained in:
Orangina Rouge 2014-02-24 23:12:36 +01:00
parent 7880ce7faa
commit dab48007cf

View file

@ -103,15 +103,17 @@ function readEXIF($file) {
$emodel = $exif_idf0['Model'];
$efocal = $exif_idf0['FocalLength'];
list($x,$y) = preg_split('/', $efocal);
$efocal = round($x/$y,0);
//Next is only cosmectic need but give an error due to division by zero
//list($x,$y) = preg_split('/', $efocal);
//$efocal = round($x/$y,0);
$exif_exif = exif_read_data ($file,'EXIF' ,0 );
$eexposuretime = $exif_exif['ExposureTime'];
$efnumber = $exif_exif['FNumber'];
list($x,$y) = preg_split('/', $efnumber);
$efnumber = round($x/$y,0);
//Next is only cosmectic need but give an error due to division by zero
//list($x,$y) = preg_split('/', $efnumber);
//$efnumber = round($x/$y,0);
$eiso = $exif_exif['ISOSpeedRatings'];
@ -221,15 +223,23 @@ if (file_exists($currentdir ."/captions.txt"))
if (preg_match("/.jpg$|.gif$|.png$/i", $file))
{
//Read EXIF
if ($display_exif == 1) $img_captions[$file] .= readEXIF($currentdir . "/" . $file);
if ($display_exif == 1)
{
$exifReaden= readEXIF($currentdir . "/" . $file);
//Add to the caption all the EXIF information
$img_captions[$file] = $file.$exifReaden;
}
else
{
//If no EXIF, just use the filename as caption
$img_captions[$file] = $file;
}
// Read the optionnal image title and caption in html file (image.jpg --> image.jpg.html)
// Format: title::caption
// Example: My cat::My cat like to <i>roll</i> on the floor.
// If file is not provided, image filename will be used instead.
checkpermissions($currentdir . "/" . $file);
$img_captions[$file] = $file;
if (is_file($currentdir.'/'.$file.'.html')) { $img_captions[$file] = $file.'::'.htmlspecialchars(file_get_contents($currentdir.'/'.$file.'.html'),ENT_QUOTES); }
if ($lazyload) {
$files[] = array (