Esempio n. 1
0
 static function __static()
 {
     self::$EMPTY = new self();
 }
Esempio n. 2
0
<?php

header('Content-type: text/html; charset=utf-8');
?>

<html>
<head>
<title>Pagina di esperimenti 2</title>
<script src="../js/jquery.js"></script>
</head>
<body>
<?php 
include_once 'PiazzoleService.php';
include_once 'config.php';
$percorso = AIRO_FS_FOLDER_FOTO_PODIO . "04GROA_23.jpg";
$g = new ExifData($percorso);
echo "Oggetto speciale ExifData<br/>";
// echo "FileName: $g->FileName<br/>";
echo "Nome: {$g->Nome}<br/>";
echo "Produttore: {$g->Produttore}<br/>";
echo "Modello: {$g->Modello}<br/>";
echo "Dimensioni: {$g->Dimensioni}<br/>";
echo "Desc Dimensioni: {$g->DescDimensioni}<br/>";
echo "Data Scatto: {$g->DataScatto}<br/>";
echo "Data Modifica: {$g->DataModifica}<br/>";
echo "Focale: {$g->Focale}<br/>";
echo "BilanciamentoBianco: {$g->BilanciamentoBianco}<br/>";
// $f = exif_read_data($percorso, 0, true);
$json = $g->serialize();
echo "<br/><br/><br/>{$json}";
?>
 /**
  * Returns an ExifData instance or NULL if this image does not contain 
  * EXIF Data
  * 
  * @return img.util.ExifData
  */
 public function exifData()
 {
     if (!($seg = $this->segmentsOf('img.io.ExifSegment'))) {
         return NULL;
     }
     // Populate ExifData instance from ExifSegment's raw data
     with($data = new ExifData(), $raw = $seg[0]->rawData());
     $data->setFileName($this->source);
     $data->setFileSize(-1);
     $data->setMimeType('image/jpeg');
     $data->setMake(NULL === ($l = self::lookup($raw, 'Make')) ? NULL : trim($l));
     $data->setModel(NULL === ($l = self::lookup($raw, 'Model')) ? NULL : trim($l));
     $data->setSoftware(NULL === ($l = self::lookup($raw, 'Software')) ? NULL : trim($l));
     $exif = $raw['Exif_IFD_Pointer']['data'];
     if ($sof = $this->segmentsOf('img.io.SOFNSegment')) {
         $data->setWidth($sof[0]->width());
         $data->setHeight($sof[0]->height());
     } else {
         $data->setWidth(self::lookup($exif, 'ExifImageWidth'));
         $data->setHeight(self::lookup($exif, 'ExifImageLength'));
     }
     // Aperture is either a FNumber (use directly), otherwise calculate from value
     if (NULL === ($a = self::lookup($exif, 'FNumber'))) {
         if (NULL === ($a = self::lookup($exif, 'ApertureValue', 'MaxApertureValue'))) {
             $data->setApertureFNumber(NULL);
         } else {
             sscanf($a, '%d/%d', $n, $frac);
             $data->setApertureFNumber(sprintf('f/%.1F', exp($n / $frac * log(2) * 0.5)));
         }
     } else {
         sscanf($a, '%d/%d', $n, $frac);
         $data->setApertureFNumber(sprintf('f/%.1F', $n / $frac));
     }
     $data->setExposureTime(self::lookup($exif, 'ExposureTime'));
     $data->setExposureProgram(self::lookup($exif, 'ExposureProgram'));
     $data->setMeteringMode(self::lookup($exif, 'MeteringMode'));
     $data->setIsoSpeedRatings(self::lookup($exif, 'ISOSpeedRatings'));
     // Sometimes white balance is in MAKERNOTE - e.g. FUJIFILM's Finepix
     if (NULL !== ($w = self::lookup($exif, 'WhiteBalance'))) {
         $data->setWhiteBalance($w);
     } else {
         if (isset($exif['MakerNote']) && NULL !== ($w = self::lookup($exif['MakerNote']['data'], 'WhiteBalance'))) {
             $data->setWhiteBalance($w);
         } else {
             $data->setWhiteBalance(NULL);
         }
     }
     // Extract focal length. Some models store "80" as "80/1", rip off
     // the divisor "1" in this case.
     if (NULL !== ($l = self::lookup($exif, 'FocalLength'))) {
         sscanf($l, '%d/%d', $n, $frac);
         $data->setFocalLength(1 == $frac ? $n : $n . '/' . $frac);
     } else {
         $data->setFocalLength(NULL);
     }
     // Check for Flash and flashUsed keys
     if (NULL !== ($f = self::lookup($exif, 'Flash'))) {
         $data->setFlash($f);
     } else {
         $data->setFlash(NULL);
     }
     if (NULL !== ($date = self::lookup($exif, 'DateTimeOriginal', 'DateTimeDigitized', 'DateTime'))) {
         $t = sscanf($date, '%4d:%2d:%2d %2d:%2d:%2d');
         $data->setDateTime(new Date(mktime($t[3], $t[4], $t[5], $t[1], $t[2], $t[0])));
     }
     if (NULL !== ($o = self::lookup($exif, 'Orientation'))) {
         $data->setOrientation($o);
     } else {
         $data->setOrientation($data->width / $data->height > 1.0 ? 1 : 5);
     }
     return $data;
 }
 public function defaultValueIfNotFound()
 {
     $this->assertNull(ExifData::fromFile($this->resourceAsFile('iptc-only.jpg'), NULL));
 }
Esempio n. 5
0
function getFotoInfo($file, $tipo)
{
    /* 	echo "Tipo: $tipo.<br/>";
    	
    	$esito = file_exists(AIRO_FOLDER_FOTO_PODIO . $file);
    	echo "Esito verifica su file '" . AIRO_FOLDER_FOTO_PODIO . $file . "': $esito.<br/>";
    	
    	$esito = file_exists(AIRO_FOLDER_FOTO_DA_ASSOCIARE . $file);
    	echo "Esito verifica su file '" . AIRO_FOLDER_FOTO_DA_ASSOCIARE . $file . "': $esito.<br/>";
    */
    switch (strtolower($tipo)) {
        case 'abbinate':
            $path = AIRO_FS_FOLDER_FOTO_PODIO . $file;
            break;
        case 'nonabbinate':
            $path = AIRO_FS_FOLDER_FOTO_DA_ASSOCIARE . $file;
            break;
        default:
            return "Il valore di tipo: '{$tipo}' non è ammesso.";
            break;
    }
    $myinfo = new ExifData($path);
    return $myinfo->serialize();
}