Ejemplo n.º 1
0
 /**
  * Get the value of an entry as text.
  *
  * The value will be returned in a format suitable for presentation,
  * e.g., rationals will be returned as 'x/y', ASCII strings will be
  * returned as themselves etc.
  *
  * @param boolean some values can be returned in a long or more
  * brief form, and this parameter controls that.
  *
  * @return string the value as text.
  */
 function getText($brief = false)
 {
     if (isset($this->value[0])) {
         $v = $this->value[0];
     }
     switch ($this->tag) {
         case PelTag::FNUMBER:
             //CC (e->components, 1, v);
             return Pel::fmt('f/%.01f', $v[0] / $v[1]);
         case PelTag::APERTURE_VALUE:
             //CC (e->components, 1, v);
             //if (!v_rat.denominator) return (NULL);
             return Pel::fmt('f/%.01f', pow(2, $v[0] / $v[1] / 2));
         case PelTag::FOCAL_LENGTH:
             //CC (e->components, 1, v);
             //if (!v_rat.denominator) return (NULL);
             return Pel::fmt('%.1f mm', $v[0] / $v[1]);
         case PelTag::SUBJECT_DISTANCE:
             //CC (e->components, 1, v);
             //if (!v_rat.denominator) return (NULL);
             return Pel::fmt('%.1f m', $v[0] / $v[1]);
         case PelTag::EXPOSURE_TIME:
             //CC (e->components, 1, v);
             //if (!v_rat.denominator) return (NULL);
             if ($v[0] / $v[1] < 1) {
                 return Pel::fmt('1/%d sec.', $v[1] / $v[0]);
             } else {
                 return Pel::fmt('%d sec.', $v[0] / $v[1]);
             }
         case PelTag::GPS_LATITUDE:
         case PelTag::GPS_LONGITUDE:
             $degrees = $this->value[0][0] / $this->value[0][1];
             $minutes = $this->value[1][0] / $this->value[1][1];
             $seconds = $this->value[2][0] / $this->value[2][1];
             return sprintf('%s° %s\' %s" (%.2f°)', $degrees, $minutes, $seconds, $degrees + $minutes / 60 + $seconds / 3600);
         default:
             return parent::getText($brief);
     }
 }