/** * Turn this directory into text. * * @return string information about the directory, mainly for * debugging. */ function __toString() { $str = Pel::fmt("Dumping IFD %s with %d entries...\n", $this->getName(), count($this->entries)); foreach ($this->entries as $entry) { $str .= $entry->__toString(); } $str .= Pel::fmt("Dumping %d sub IFDs...\n", count($this->sub)); foreach ($this->sub as $type => $ifd) { $str .= $ifd->__toString(); } if ($this->next != null) { $str .= $this->next->__toString(); } return $str; }
/** * 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::SHUTTER_SPEED_VALUE: //CC (e->components, 1, v); //if (!v_srat.denominator) return (NULL); return Pel::fmt('%.0f/%.0f sec. (APEX: %d)', $v[0], $v[1], pow(sqrt(2), $v[0] / $v[1])); case PelTag::BRIGHTNESS_VALUE: //CC (e->components, 1, v); // // TODO: figure out the APEX thing, or remove this so that it is // handled by the default clause at the bottom. return sprintf('%d/%d', $v[0], $v[1]); //FIXME: How do I calculate the APEX value? //FIXME: How do I calculate the APEX value? case PelTag::EXPOSURE_BIAS_VALUE: //CC (e->components, 1, v); //if (!v_srat.denominator) return (NULL); return sprintf('%s%.01f', $v[0] * $v[1] > 0 ? '+' : '', $v[0] / $v[1]); default: return parent::getText($brief); } }
/** * Return a text string with the version. * * @param boolean controls if the output should be brief. Brief * output omits the word 'Version' so the result is just 'Exif x.y' * instead of 'Exif Version x.y' if the entry holds information * about the Exif version --- the output for FlashPix is similar. * * @return string the version number with the type of the tag, * either 'Exif' or 'FlashPix'. */ function getText($brief = false) { $v = $this->version; /* Versions numbers like 2.0 would be output as just 2 if we don't * add the '.0' ourselves. */ if (floor($this->version) == $this->version) { $v .= '.0'; } switch ($this->tag) { case PelTag::EXIF_VERSION: if ($brief) { return Pel::fmt('Exif %s', $v); } else { return Pel::fmt('Exif Version %s', $v); } case PelTag::FLASH_PIX_VERSION: if ($brief) { return Pel::fmt('FlashPix %s', $v); } else { return Pel::fmt('FlashPix Version %s', $v); } case PelTag::INTEROPERABILITY_VERSION: if ($brief) { return Pel::fmt('Interoperability %s', $v); } else { return Pel::fmt('Interoperability Version %s', $v); } } if ($brief) { return $v; } else { return Pel::fmt('Version %s', $v); } }
/** * Return a string representation of this object. * * @return string a string describing this object. This is mostly useful * for debugging. */ public function __toString() { $str = Pel::fmt("Dumping TIFF data...\n"); if ($this->ifd != null) { $str .= $this->ifd->__toString(); } return $str; }
/** * Return the size of components in a given format. * * @param PelFormat the format. * * @return the size in bytes needed to store one component with the * given format. */ static function getSize($type) { switch ($type) { case self::ASCII: return 1; case self::BYTE: return 1; case self::SHORT: return 2; case self::LONG: return 4; case self::RATIONAL: return 8; case self::SBYTE: return 1; case self::SSHORT: return 2; case self::SLONG: return 4; case self::SRATIONAL: return 8; case self::FLOAT: return 4; case self::DOUBLE: return 8; case self::UNDEFINED: return 1; default: return Pel::fmt('Unknown format: 0x%X', $type); } }
/** * Make a string representation of this JPEG object. * * This is mainly usefull for debugging. It will show the structure * of the image, and its sections. * * @return string debugging information about this JPEG object. */ function __toString() { $str = Pel::tra("Dumping JPEG data...\n"); for ($i = 0; $i < count($this->sections); $i++) { $m = $this->sections[$i][0]; $c = $this->sections[$i][1]; $str .= Pel::fmt("Section %d (marker 0x%02X - %s):\n", $i, $m, PelJpegMarker::getName($m)); $str .= Pel::fmt(" Description: %s\n", PelJpegMarker::getDescription($m)); if ($m == PelJpegMarker::SOI || $m == PelJpegMarker::EOI) { continue; } if ($c instanceof PelExif) { $str .= Pel::tra(" Content : Exif data\n"); $str .= $c->__toString() . "\n"; } elseif ($c instanceof PelJpegComment) { $str .= Pel::fmt(" Content : %s\n", $c->getValue()); } else { $str .= Pel::tra(" Content : Unknown\n"); } } return $str; }
/** * Returns a title for an Exif tag. * * @param * int the IFD type of the tag, one of {@link PelIfd::IFD0}, * {@link PelIfd::IFD1}, {@link PelIfd::EXIF}, {@link PelIfd::GPS}, * or {@link PelIfd::INTEROPERABILITY}. * * @param * PelTag the tag. * * @return string the title of the tag, e.g., 'Image Width' for the * {@link IMAGE_WIDTH} tag. If the tag isn't known, the string * 'Unknown Tag: 0xTT' will be returned where 'TT' is the * hexadecimal representation of the tag. */ public function getTitle($type, $tag) { switch ($type) { case PelIfd::IFD0: case PelIfd::IFD1: case PelIfd::EXIF: case PelIfd::INTEROPERABILITY: switch ($tag) { case self::INTEROPERABILITY_INDEX: return Pel::tra('Interoperability Index'); case self::INTEROPERABILITY_VERSION: return Pel::tra('Interoperability Version'); case self::IMAGE_WIDTH: return Pel::tra('Image Width'); case self::IMAGE_LENGTH: return Pel::tra('Image Length'); case self::BITS_PER_SAMPLE: return Pel::tra('Bits per Sample'); case self::COMPRESSION: return Pel::tra('Compression'); case self::PHOTOMETRIC_INTERPRETATION: return Pel::tra('Photometric Interpretation'); case self::FILL_ORDER: return Pel::tra('Fill Order'); case self::DOCUMENT_NAME: return Pel::tra('Document Name'); case self::IMAGE_DESCRIPTION: return Pel::tra('Image Description'); case self::MAKE: return Pel::tra('Manufacturer'); case self::MODEL: return Pel::tra('Model'); case self::STRIP_OFFSETS: return Pel::tra('Strip Offsets'); case self::ORIENTATION: return Pel::tra('Orientation'); case self::SAMPLES_PER_PIXEL: return Pel::tra('Samples per Pixel'); case self::ROWS_PER_STRIP: return Pel::tra('Rows per Strip'); case self::STRIP_BYTE_COUNTS: return Pel::tra('Strip Byte Count'); case self::X_RESOLUTION: return Pel::tra('x-Resolution'); case self::Y_RESOLUTION: return Pel::tra('y-Resolution'); case self::PLANAR_CONFIGURATION: return Pel::tra('Planar Configuration'); case self::RESOLUTION_UNIT: return Pel::tra('Resolution Unit'); case self::TRANSFER_FUNCTION: return Pel::tra('Transfer Function'); case self::SOFTWARE: return Pel::tra('Software'); case self::DATE_TIME: return Pel::tra('Date and Time'); case self::ARTIST: return Pel::tra('Artist'); case self::WHITE_POINT: return Pel::tra('White Point'); case self::PRIMARY_CHROMATICITIES: return Pel::tra('Primary Chromaticities'); case self::TRANSFER_RANGE: return Pel::tra('Transfer Range'); case self::JPEG_PROC: return Pel::tra('JPEG Process'); case self::JPEG_INTERCHANGE_FORMAT: return Pel::tra('JPEG Interchange Format'); case self::JPEG_INTERCHANGE_FORMAT_LENGTH: return Pel::tra('JPEG Interchange Format Length'); case self::YCBCR_COEFFICIENTS: return Pel::tra('YCbCr Coefficients'); case self::YCBCR_SUB_SAMPLING: return Pel::tra('YCbCr Sub-Sampling'); case self::YCBCR_POSITIONING: return Pel::tra('YCbCr Positioning'); case self::REFERENCE_BLACK_WHITE: return Pel::tra('Reference Black/White'); case self::RELATED_IMAGE_FILE_FORMAT: return Pel::tra('Related Image File Format'); case self::RELATED_IMAGE_WIDTH: return Pel::tra('Related Image Width'); case self::RELATED_IMAGE_LENGTH: return Pel::tra('Related Image Length'); case self::CFA_REPEAT_PATTERN_DIM: return Pel::tra('CFA Repeat Pattern Dim'); case self::CFA_PATTERN: return Pel::tra('CFA Pattern'); case self::BATTERY_LEVEL: return Pel::tra('Battery Level'); case self::COPYRIGHT: return Pel::tra('Copyright'); case self::EXPOSURE_TIME: return Pel::tra('Exposure Time'); case self::FNUMBER: return Pel::tra('FNumber'); case self::IPTC_NAA: return Pel::tra('IPTC/NAA'); case self::EXIF_IFD_POINTER: return Pel::tra('Exif IFD Pointer'); case self::INTER_COLOR_PROFILE: return Pel::tra('Inter Color Profile'); case self::EXPOSURE_PROGRAM: return Pel::tra('Exposure Program'); case self::SPECTRAL_SENSITIVITY: return Pel::tra('Spectral Sensitivity'); case self::GPS_INFO_IFD_POINTER: return Pel::tra('GPS Info IFD Pointer'); case self::ISO_SPEED_RATINGS: return Pel::tra('ISO Speed Ratings'); case self::OECF: return Pel::tra('OECF'); case self::EXIF_VERSION: return Pel::tra('Exif Version'); case self::DATE_TIME_ORIGINAL: return Pel::tra('Date and Time (original)'); case self::DATE_TIME_DIGITIZED: return Pel::tra('Date and Time (digitized)'); case self::COMPONENTS_CONFIGURATION: return Pel::tra('Components Configuration'); case self::COMPRESSED_BITS_PER_PIXEL: return Pel::tra('Compressed Bits per Pixel'); case self::SHUTTER_SPEED_VALUE: return Pel::tra('Shutter speed'); case self::APERTURE_VALUE: return Pel::tra('Aperture'); case self::BRIGHTNESS_VALUE: return Pel::tra('Brightness'); case self::EXPOSURE_BIAS_VALUE: return Pel::tra('Exposure Bias'); case self::MAX_APERTURE_VALUE: return Pel::tra('Max Aperture Value'); case self::SUBJECT_DISTANCE: return Pel::tra('Subject Distance'); case self::METERING_MODE: return Pel::tra('Metering Mode'); case self::LIGHT_SOURCE: return Pel::tra('Light Source'); case self::FLASH: return Pel::tra('Flash'); case self::FOCAL_LENGTH: return Pel::tra('Focal Length'); case self::MAKER_NOTE: return Pel::tra('Maker Note'); case self::USER_COMMENT: return Pel::tra('User Comment'); case self::SUB_SEC_TIME: return Pel::tra('SubSec Time'); case self::SUB_SEC_TIME_ORIGINAL: return Pel::tra('SubSec Time Original'); case self::SUB_SEC_TIME_DIGITIZED: return Pel::tra('SubSec Time Digitized'); case self::XP_TITLE: return 'Windows XP Title'; case self::XP_COMMENT: return 'Windows XP Comment'; case self::XP_AUTHOR: return 'Windows XP Author'; case self::XP_KEYWORDS: return 'Windows XP Keywords'; case self::XP_SUBJECT: return 'Windows XP Subject'; case self::FLASH_PIX_VERSION: return Pel::tra('FlashPix Version'); case self::COLOR_SPACE: return Pel::tra('Color Space'); case self::PIXEL_X_DIMENSION: return Pel::tra('Pixel x-Dimension'); case self::PIXEL_Y_DIMENSION: return Pel::tra('Pixel y-Dimension'); case self::RELATED_SOUND_FILE: return Pel::tra('Related Sound File'); case self::INTEROPERABILITY_IFD_POINTER: return Pel::tra('Interoperability IFD Pointer'); case self::FLASH_ENERGY: return Pel::tra('Flash Energy'); case self::SPATIAL_FREQUENCY_RESPONSE: return Pel::tra('Spatial Frequency Response'); case self::FOCAL_PLANE_X_RESOLUTION: return Pel::tra('Focal Plane x-Resolution'); case self::FOCAL_PLANE_Y_RESOLUTION: return Pel::tra('Focal Plane y-Resolution'); case self::FOCAL_PLANE_RESOLUTION_UNIT: return Pel::tra('Focal Plane Resolution Unit'); case self::SUBJECT_LOCATION: return Pel::tra('Subject Location'); case self::EXPOSURE_INDEX: return Pel::tra('Exposure index'); case self::SENSING_METHOD: return Pel::tra('Sensing Method'); case self::FILE_SOURCE: return Pel::tra('File Source'); case self::SCENE_TYPE: return Pel::tra('Scene Type'); case self::SUBJECT_AREA: return Pel::tra('Subject Area'); case self::CUSTOM_RENDERED: return Pel::tra('Custom Rendered'); case self::EXPOSURE_MODE: return Pel::tra('Exposure Mode'); case self::WHITE_BALANCE: return Pel::tra('White Balance'); case self::DIGITAL_ZOOM_RATIO: return Pel::tra('Digital Zoom Ratio'); case self::FOCAL_LENGTH_IN_35MM_FILM: return Pel::tra('Focal Length In 35mm Film'); case self::SCENE_CAPTURE_TYPE: return Pel::tra('Scene Capture Type'); case self::GAIN_CONTROL: return Pel::tra('Gain Control'); case self::CONTRAST: return Pel::tra('Contrast'); case self::SATURATION: return Pel::tra('Saturation'); case self::SHARPNESS: return Pel::tra('Sharpness'); case self::DEVICE_SETTING_DESCRIPTION: return Pel::tra('Device Setting Description'); case self::SUBJECT_DISTANCE_RANGE: return Pel::tra('Subject Distance Range'); case self::IMAGE_UNIQUE_ID: return Pel::tra('Image Unique ID'); case self::GAMMA: return Pel::tra('Gamma'); case self::PRINT_IM: return Pel::tra('Print IM'); } return Pel::fmt('Unknown Tag: 0x%04X', $tag); case PelIfd::GPS: switch ($tag) { case self::GPS_VERSION_ID: return 'GPSVersionID'; case self::GPS_LATITUDE_REF: return 'GPSLatitudeRef'; case self::GPS_LATITUDE: return 'GPSLatitude'; case self::GPS_LONGITUDE_REF: return 'GPSLongitudeRef'; case self::GPS_LONGITUDE: return 'GPSLongitude'; case self::GPS_ALTITUDE_REF: return 'GPSAltitudeRef'; case self::GPS_ALTITUDE: return 'GPSAltitude'; case self::GPS_TIME_STAMP: return 'GPSTimeStamp'; case self::GPS_SATELLITES: return 'GPSSatellites'; case self::GPS_STATUS: return 'GPSStatus'; case self::GPS_MEASURE_MODE: return 'GPSMeasureMode'; case self::GPS_DOP: return 'GPSDOP'; case self::GPS_SPEED_REF: return 'GPSSpeedRef'; case self::GPS_SPEED: return 'GPSSpeed'; case self::GPS_TRACK_REF: return 'GPSTrackRef'; case self::GPS_TRACK: return 'GPSTrack'; case self::GPS_IMG_DIRECTION_REF: return 'GPSImgDirectionRef'; case self::GPS_IMG_DIRECTION: return 'GPSImgDirection'; case self::GPS_MAP_DATUM: return 'GPSMapDatum'; case self::GPS_DEST_LATITUDE_REF: return 'GPSDestLatitudeRef'; case self::GPS_DEST_LATITUDE: return 'GPSDestLatitude'; case self::GPS_DEST_LONGITUDE_REF: return 'GPSDestLongitudeRef'; case self::GPS_DEST_LONGITUDE: return 'GPSDestLongitude'; case self::GPS_DEST_BEARING_REF: return 'GPSDestBearingRef'; case self::GPS_DEST_BEARING: return 'GPSDestBearing'; case self::GPS_DEST_DISTANCE_REF: return 'GPSDestDistanceRef'; case self::GPS_DEST_DISTANCE: return 'GPSDestDistance'; case self::GPS_PROCESSING_METHOD: return 'GPSProcessingMethod'; case self::GPS_AREA_INFORMATION: return 'GPSAreaInformation'; case self::GPS_DATE_STAMP: return 'GPSDateStamp'; case self::GPS_DIFFERENTIAL: return 'GPSDifferential'; } return Pel::fmt('Unknown Tag: 0x%04X', $tag); default: return Pel::fmt('Unknown Tag: 0x%04X', $tag); } }
/** * Turn this entry into a string. * * @return string a string representation of this entry. This is * mostly for debugging. */ function __toString() { $str = Pel::fmt(" Tag: 0x%04X (%s)\n", $this->tag, PelTag::getName($this->ifd_type, $this->tag)); $str .= Pel::fmt(" Format : %d (%s)\n", $this->format, PelFormat::getName($this->format)); $str .= Pel::fmt(" Components: %d\n", $this->components); if ($this->getTag() != PelTag::MAKER_NOTE && $this->getTag() != PelTag::PRINT_IM) { $str .= Pel::fmt(" Value : %s\n", print_r($this->getValue(), true)); } $str .= Pel::fmt(" Text : %s\n", $this->getText()); return $str; }
/** * Get the value of an entry as text. * * The value will be returned in a format suitable for presentation, * e.g., instead of returning '2' for a {@link * PelTag::METERING_MODE} tag, 'Center-Weighted Average' is * returned. * * @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) { switch ($this->tag) { case PelTag::METERING_MODE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Unknown'); case 1: return Pel::tra('Average'); case 2: return Pel::tra('Center-Weighted Average'); case 3: return Pel::tra('Spot'); case 4: return Pel::tra('Multi Spot'); case 5: return Pel::tra('Pattern'); case 6: return Pel::tra('Partial'); case 255: return Pel::tra('Other'); default: return $this->value[0]; } case PelTag::COMPRESSION: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('Uncompressed'); case 6: return Pel::tra('JPEG compression'); default: return $this->value[0]; } case PelTag::PLANAR_CONFIGURATION: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('chunky format'); case 2: return Pel::tra('planar format'); default: return $this->value[0]; } case PelTag::SENSING_METHOD: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('Not defined'); case 2: return Pel::tra('One-chip color area sensor'); case 3: return Pel::tra('Two-chip color area sensor'); case 4: return Pel::tra('Three-chip color area sensor'); case 5: return Pel::tra('Color sequential area sensor'); case 7: return Pel::tra('Trilinear sensor'); case 8: return Pel::tra('Color sequential linear sensor'); default: return $this->value[0]; } case PelTag::LIGHT_SOURCE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Unknown'); case 1: return Pel::tra('Daylight'); case 2: return Pel::tra('Fluorescent'); case 3: return Pel::tra('Tungsten (incandescent light)'); case 4: return Pel::tra('Flash'); case 9: return Pel::tra('Fine weather'); case 10: return Pel::tra('Cloudy weather'); case 11: return Pel::tra('Shade'); case 12: return Pel::tra('Daylight fluorescent'); case 13: return Pel::tra('Day white fluorescent'); case 14: return Pel::tra('Cool white fluorescent'); case 15: return Pel::tra('White fluorescent'); case 17: return Pel::tra('Standard light A'); case 18: return Pel::tra('Standard light B'); case 19: return Pel::tra('Standard light C'); case 20: return Pel::tra('D55'); case 21: return Pel::tra('D65'); case 22: return Pel::tra('D75'); case 24: return Pel::tra('ISO studio tungsten'); case 255: return Pel::tra('Other'); default: return $this->value[0]; } case PelTag::FOCAL_PLANE_RESOLUTION_UNIT: case PelTag::RESOLUTION_UNIT: //CC (e->components, 1, v); switch ($this->value[0]) { case 2: return Pel::tra('Inch'); case 3: return Pel::tra('Centimeter'); default: return $this->value[0]; } case PelTag::EXPOSURE_PROGRAM: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Not defined'); case 1: return Pel::tra('Manual'); case 2: return Pel::tra('Normal program'); case 3: return Pel::tra('Aperture priority'); case 4: return Pel::tra('Shutter priority'); case 5: return Pel::tra('Creative program (biased toward depth of field)'); case 6: return Pel::tra('Action program (biased toward fast shutter speed)'); case 7: return Pel::tra('Portrait mode (for closeup photos with the background out of focus'); case 8: return Pel::tra('Landscape mode (for landscape photos with the background in focus'); default: return $this->value[0]; } case PelTag::ORIENTATION: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('top - left'); case 2: return Pel::tra('top - right'); case 3: return Pel::tra('bottom - right'); case 4: return Pel::tra('bottom - left'); case 5: return Pel::tra('left - top'); case 6: return Pel::tra('right - top'); case 7: return Pel::tra('right - bottom'); case 8: return Pel::tra('left - bottom'); default: return $this->value[0]; } case PelTag::YCBCR_POSITIONING: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('centered'); case 2: return Pel::tra('co-sited'); default: return $this->value[0]; } case PelTag::YCBCR_SUB_SAMPLING: //CC (e->components, 2, v); if ($this->value[0] == 2 && $this->value[1] == 1) { return 'YCbCr4:2:2'; } if ($this->value[0] == 2 && $this->value[1] == 2) { return 'YCbCr4:2:0'; } return $this->value[0] . ', ' . $this->value[1]; case PelTag::PHOTOMETRIC_INTERPRETATION: //CC (e->components, 1, v); switch ($this->value[0]) { case 2: return 'RGB'; case 6: return 'YCbCr'; default: return $this->value[0]; } case PelTag::COLOR_SPACE: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return 'sRGB'; case 2: return 'Adobe RGB'; case 0xffff: return Pel::tra('Uncalibrated'); default: return $this->value[0]; } case PelTag::FLASH: //CC (e->components, 1, v); switch ($this->value[0]) { case 0x0: return Pel::tra('Flash did not fire.'); case 0x1: return Pel::tra('Flash fired.'); case 0x5: return Pel::tra('Strobe return light not detected.'); case 0x7: return Pel::tra('Strobe return light detected.'); case 0x9: return Pel::tra('Flash fired, compulsory flash mode.'); case 0xd: return Pel::tra('Flash fired, compulsory flash mode, return light not detected.'); case 0xf: return Pel::tra('Flash fired, compulsory flash mode, return light detected.'); case 0x10: return Pel::tra('Flash did not fire, compulsory flash mode.'); case 0x18: return Pel::tra('Flash did not fire, auto mode.'); case 0x19: return Pel::tra('Flash fired, auto mode.'); case 0x1d: return Pel::tra('Flash fired, auto mode, return light not detected.'); case 0x1f: return Pel::tra('Flash fired, auto mode, return light detected.'); case 0x20: return Pel::tra('No flash function.'); case 0x41: return Pel::tra('Flash fired, red-eye reduction mode.'); case 0x45: return Pel::tra('Flash fired, red-eye reduction mode, return light not detected.'); case 0x47: return Pel::tra('Flash fired, red-eye reduction mode, return light detected.'); case 0x49: return Pel::tra('Flash fired, compulsory flash mode, red-eye reduction mode.'); case 0x4d: return Pel::tra('Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected.'); case 0x4f: return Pel::tra('Flash fired, compulsory flash mode, red-eye reduction mode, return light detected.'); case 0x58: return Pel::tra('Flash did not fire, auto mode, red-eye reduction mode.'); case 0x59: return Pel::tra('Flash fired, auto mode, red-eye reduction mode.'); case 0x5d: return Pel::tra('Flash fired, auto mode, return light not detected, red-eye reduction mode.'); case 0x5f: return Pel::tra('Flash fired, auto mode, return light detected, red-eye reduction mode.'); default: return $this->value[0]; } case PelTag::CUSTOM_RENDERED: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Normal process'); case 1: return Pel::tra('Custom process'); default: return $this->value[0]; } case PelTag::EXPOSURE_MODE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Auto exposure'); case 1: return Pel::tra('Manual exposure'); case 2: return Pel::tra('Auto bracket'); default: return $this->value[0]; } case PelTag::WHITE_BALANCE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Auto white balance'); case 1: return Pel::tra('Manual white balance'); default: return $this->value[0]; } case PelTag::SCENE_CAPTURE_TYPE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Standard'); case 1: return Pel::tra('Landscape'); case 2: return Pel::tra('Portrait'); case 3: return Pel::tra('Night scene'); default: return $this->value[0]; } case PelTag::GAIN_CONTROL: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Normal'); case 1: return Pel::tra('Low gain up'); case 2: return Pel::tra('High gain up'); case 3: return Pel::tra('Low gain down'); case 4: return Pel::tra('High gain down'); default: return $this->value[0]; } case PelTag::SATURATION: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Normal'); case 1: return Pel::tra('Low saturation'); case 2: return Pel::tra('High saturation'); default: return $this->value[0]; } case PelTag::CONTRAST: case PelTag::SHARPNESS: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Normal'); case 1: return Pel::tra('Soft'); case 2: return Pel::tra('Hard'); default: return $this->value[0]; } case PelTag::SUBJECT_DISTANCE_RANGE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Unknown'); case 1: return Pel::tra('Macro'); case 2: return Pel::tra('Close view'); case 3: return Pel::tra('Distant view'); default: return $this->value[0]; } case PelTag::SUBJECT_AREA: switch ($this->components) { case 2: return Pel::fmt('(x,y) = (%d,%d)', $this->value[0], $this->value[1]); case 3: return Pel::fmt('Within distance %d of (x,y) = (%d,%d)', $this->value[0], $this->value[1], $this->value[2]); case 4: return Pel::fmt('Within rectangle (width %d, height %d) around (x,y) = (%d,%d)', $this->value[0], $this->value[1], $this->value[2], $this->value[3]); default: return Pel::fmt('Unexpected number of components (%d, expected 2, 3, or 4).', $this->components); } default: return parent::getText($brief); } }
/** * 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. */ public 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]); } break; 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); } }
/** * Returns a description of a JPEG marker. * * @param PelJpegMarker the marker. * * @return string the description of the marker. */ static function getDescription($m) { switch ($m) { case self::SOF0: return Pel::tra('Encoding (baseline)'); case self::SOF1: return Pel::tra('Encoding (extended sequential)'); case self::SOF2: return Pel::tra('Encoding (progressive)'); case self::SOF3: return Pel::tra('Encoding (lossless)'); case self::SOF5: return Pel::tra('Encoding (differential sequential)'); case self::SOF6: return Pel::tra('Encoding (differential progressive)'); case self::SOF7: return Pel::tra('Encoding (differential lossless)'); case self::SOF9: return Pel::tra('Encoding (extended sequential, arithmetic)'); case self::SOF10: return Pel::tra('Encoding (progressive, arithmetic)'); case self::SOF11: return Pel::tra('Encoding (lossless, arithmetic)'); case self::SOF13: return Pel::tra('Encoding (differential sequential, arithmetic)'); case self::SOF14: return Pel::tra('Encoding (differential progressive, arithmetic)'); case self::SOF15: return Pel::tra('Encoding (differential lossless, arithmetic)'); case self::SOI: return Pel::tra('Start of image'); case self::EOI: return Pel::tra('End of image'); case self::SOS: return Pel::tra('Start of scan'); case self::COM: return Pel::tra('Comment'); case self::DHT: return Pel::tra('Define Huffman table'); case self::JPG: return Pel::tra('Extension'); case self::DAC: return Pel::tra('Define arithmetic coding conditioning'); case self::RST0: return Pel::fmt('Restart %d', 0); case self::RST1: return Pel::fmt('Restart %d', 1); case self::RST2: return Pel::fmt('Restart %d', 2); case self::RST3: return Pel::fmt('Restart %d', 3); case self::RST4: return Pel::fmt('Restart %d', 4); case self::RST5: return Pel::fmt('Restart %d', 5); case self::RST6: return Pel::fmt('Restart %d', 6); case self::RST7: return Pel::fmt('Restart %d', 7); case self::DQT: return Pel::tra('Define quantization table'); case self::DNL: return Pel::tra('Define number of lines'); case self::DRI: return Pel::tra('Define restart interval'); case self::DHP: return Pel::tra('Define hierarchical progression'); case self::EXP: return Pel::tra('Expand reference component'); case self::APP0: return Pel::fmt('Application segment %d', 0); case self::APP1: return Pel::fmt('Application segment %d', 1); case self::APP2: return Pel::fmt('Application segment %d', 2); case self::APP3: return Pel::fmt('Application segment %d', 3); case self::APP4: return Pel::fmt('Application segment %d', 4); case self::APP5: return Pel::fmt('Application segment %d', 5); case self::APP6: return Pel::fmt('Application segment %d', 6); case self::APP7: return Pel::fmt('Application segment %d', 7); case self::APP8: return Pel::fmt('Application segment %d', 8); case self::APP9: return Pel::fmt('Application segment %d', 9); case self::APP10: return Pel::fmt('Application segment %d', 10); case self::APP11: return Pel::fmt('Application segment %d', 11); case self::APP12: return Pel::fmt('Application segment %d', 12); case self::APP13: return Pel::fmt('Application segment %d', 13); case self::APP14: return Pel::fmt('Application segment %d', 14); case self::APP15: return Pel::fmt('Application segment %d', 15); case self::JPG0: return Pel::fmt('Extension %d', 0); case self::JPG1: return Pel::fmt('Extension %d', 1); case self::JPG2: return Pel::fmt('Extension %d', 2); case self::JPG3: return Pel::fmt('Extension %d', 3); case self::JPG4: return Pel::fmt('Extension %d', 4); case self::JPG5: return Pel::fmt('Extension %d', 5); case self::JPG6: return Pel::fmt('Extension %d', 6); case self::JPG7: return Pel::fmt('Extension %d', 7); case self::JPG8: return Pel::fmt('Extension %d', 8); case self::JPG9: return Pel::fmt('Extension %d', 9); case self::JPG10: return Pel::fmt('Extension %d', 10); case self::JPG11: return Pel::fmt('Extension %d', 11); case self::JPG12: return Pel::fmt('Extension %d', 12); case self::JPG13: return Pel::fmt('Extension %d', 13); case self::COM: return Pel::tra('Comment'); default: return Pel::fmt('Unknown marker: 0x%02X', $m); } }
/** * Return a string representation of the data window. * * @return string a description of the window with information about * the number of bytes accessible, the total number of bytes, and * the window start and stop. */ public function __toString() { return Pel::fmt('DataWindow: %d bytes in [%d, %d] of %d bytes', $this->size, $this->start, $this->start + $this->size, strlen($this->data)); }
/** * Get the value of an entry as text. * * The value will be returned in a format suitable for presentation, * e.g., instead of returning '2' for a {@link * PelTag::METERING_MODE} tag, 'Center-Weighted Average' is * returned. * * @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) { switch ($this->tag) { case PelTag::METERING_MODE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Unknown'); case 1: return Pel::tra('Average'); case 2: return Pel::tra('Center-Weighted Average'); case 3: return Pel::tra('Spot'); case 4: return Pel::tra('Multi Spot'); case 5: return Pel::tra('Pattern'); case 6: return Pel::tra('Partial'); case 255: return Pel::tra('Other'); default: return $this->value[0]; } case PelTag::COMPRESSION: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('Uncompressed'); case 6: return Pel::tra('JPEG compression'); default: return $this->value[0]; } case PelTag::PLANAR_CONFIGURATION: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('chunky format'); case 2: return Pel::tra('planar format'); default: return $this->value[0]; } case PelTag::SENSING_METHOD: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('Not defined'); case 2: return Pel::tra('One-chip color area sensor'); case 3: return Pel::tra('Two-chip color area sensor'); case 4: return Pel::tra('Three-chip color area sensor'); case 5: return Pel::tra('Color sequential area sensor'); case 7: return Pel::tra('Trilinear sensor'); case 8: return Pel::tra('Color sequential linear sensor'); default: return $this->value[0]; } case PelTag::LIGHT_SOURCE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Nieznany'); case 1: return Pel::tra('Światło dzienne'); case 2: return Pel::tra('Fluorescencyjny'); case 3: return Pel::tra('Sztuczne (żarówka)'); case 4: return Pel::tra('Lampa błyskowa'); case 9: return Pel::tra('Dobra pogoda'); case 10: return Pel::tra('Pochmurna pogoda'); case 11: return Pel::tra('Cień'); case 12: return Pel::tra('Dzienne fluorescencyjne'); case 13: return Pel::tra('Dzienne białe fluorescencyjne'); case 14: return Pel::tra('Chłodne białe fluorescencyjne '); case 15: return Pel::tra('Białe fluorescencyjne '); case 17: return Pel::tra('Standardowe światło A'); case 18: return Pel::tra('Standardowe światło B'); case 19: return Pel::tra('Standardowe światło C'); case 20: return Pel::tra('D55'); case 21: return Pel::tra('D65'); case 22: return Pel::tra('D75'); case 24: return Pel::tra('ISO studyjna żarówka'); case 255: return Pel::tra('Inne'); default: return $this->value[0]; } case PelTag::FOCAL_PLANE_RESOLUTION_UNIT: case PelTag::RESOLUTION_UNIT: //CC (e->components, 1, v); switch ($this->value[0]) { case 2: return Pel::tra('Inch'); case 3: return Pel::tra('Centimeter'); default: return $this->value[0]; } case PelTag::EXPOSURE_PROGRAM: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Niezdefiniowany'); case 1: return Pel::tra('Ręczny'); case 2: return Pel::tra('Normalny'); case 3: return Pel::tra('Priorytet przysłony'); case 4: return Pel::tra('Priorytet migawki'); case 5: return Pel::tra('Kreatywny (duża głębia ostrości)'); case 6: return Pel::tra('Aktywny (duża szybkość migawki)'); case 7: return Pel::tra('Tryb portretowy (dla zdjęcia z bliska z nieostrym tłem'); case 8: return Pel::tra('Tryb krajobrazowy (dla zdjęcia z tłem)'); default: return $this->value[0]; } case PelTag::ORIENTATION: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('góra - lewo'); case 2: return Pel::tra('góra - prawo'); case 3: return Pel::tra('dół - prawo'); case 4: return Pel::tra('dół - lewo'); case 5: return Pel::tra('lewo - góra'); case 6: return Pel::tra('prawo - góra'); case 7: return Pel::tra('prawo - dół'); case 8: return Pel::tra('lewo - dół'); default: return $this->value[0]; } case PelTag::YCBCR_POSITIONING: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return Pel::tra('centered'); case 2: return Pel::tra('co-sited'); default: return $this->value[0]; } case PelTag::YCBCR_SUB_SAMPLING: //CC (e->components, 2, v); if ($this->value[0] == 2 && $this->value[1] == 1) { return 'YCbCr4:2:2'; } if ($this->value[0] == 2 && $this->value[1] == 2) { return 'YCbCr4:2:0'; } return $this->value[0] . ', ' . $this->value[1]; case PelTag::PHOTOMETRIC_INTERPRETATION: //CC (e->components, 1, v); switch ($this->value[0]) { case 2: return 'RGB'; case 6: return 'YCbCr'; default: return $this->value[0]; } case PelTag::COLOR_SPACE: //CC (e->components, 1, v); switch ($this->value[0]) { case 1: return 'sRGB'; case 2: return 'Adobe RGB'; case 0xffff: return Pel::tra('Uncalibrated'); default: return $this->value[0]; } case PelTag::FLASH: //CC (e->components, 1, v); switch ($this->value[0]) { case 0x0: return Pel::tra('Bez błysku flesza.'); case 0x1: return Pel::tra('Z błyskiem flesza.'); case 0x5: return Pel::tra('Światło odbite nie wykryte.'); case 0x7: return Pel::tra('Światło odbite wykryte.'); case 0x9: return Pel::tra('Z błyskiem flesza, obowiązkowy tryb lampy błyskowej.'); case 0xd: return Pel::tra('Z błyskiem flesza, obowiązkowy tryb lampy błyskowej, światło odbite nie wykryte.'); case 0xf: return Pel::tra('Z błyskiem flesza, obowiązkowy tryb lampy błyskowej, światło odbite wykryte.'); case 0x10: return Pel::tra('Bez błysku flesza, obowiązkowy tryb lampy błyskowej.'); case 0x18: return Pel::tra('Bez błysku flesza, tryb automatyczny.'); case 0x19: return Pel::tra('Z błyskiem flesza, tryb automatyczny.'); case 0x1d: return Pel::tra('Z błyskiem flesza, tryb automatyczny, światło odbite nie wykryte.'); case 0x1f: return Pel::tra('Z błyskiem flesza, tryb automatyczny, światło odbite wykryte.'); case 0x20: return Pel::tra('Brak funkcji flesz.'); case 0x41: return Pel::tra('Z błyskiem flesza, tryb redukcji czerwonych oczu.'); case 0x45: return Pel::tra('Z błyskiem flesza, tryb redukcji czerwonych oczu, światło odbite nie wykryte.'); case 0x47: return Pel::tra('Z błyskiem flesza, tryb redukcji czerwonych oczu, światło odbite wykryte.'); case 0x49: return Pel::tra('Z błyskiem flesza, obowiązkowy tryb lampy błyskowej, tryp redukcji czerwonych oczu.'); case 0x4d: return Pel::tra('Z błyskiem flesza, obowiązkowy tryb lampy błyskowej, tryp redukcji czerwonych oczu, światło odbite nie wykryte.'); case 0x4f: return Pel::tra('Z błyskiem flesza, obowiązkowy tryb lampy błyskowej, tryp redukcji czerwonych oczu, światło odbite wykryte.'); case 0x58: return Pel::tra('Bez lampy błyskowej, tryb automatyczny, tryb redukcji czerwonych oczu.'); case 0x59: return Pel::tra('Z lampą błyskową, tryb automatyczny, tryb redukcji czerwonych oczu.'); case 0x5d: return Pel::tra('Z lampą błyskową, tryb automatyczny, światło odbite nie wykryte, tryb redukcji czerwonych oczu.'); case 0x5f: return Pel::tra('Z lampą błyskową, tryb automatyczny, światło odbite wykryte, tryb redukcji czerwonych oczu.'); default: return $this->value[0]; } case PelTag::CUSTOM_RENDERED: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Normal process'); case 1: return Pel::tra('Custom process'); default: return $this->value[0]; } case PelTag::EXPOSURE_MODE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Automatyczny'); case 1: return Pel::tra('Ręczny'); case 2: return Pel::tra('Auto bracket'); default: return $this->value[0]; } case PelTag::WHITE_BALANCE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Automatyczny'); case 1: return Pel::tra('Ręczny'); default: return $this->value[0]; } case PelTag::SCENE_CAPTURE_TYPE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Standard'); case 1: return Pel::tra('Landscape'); case 2: return Pel::tra('Portrait'); case 3: return Pel::tra('Night scene'); default: return $this->value[0]; } case PelTag::GAIN_CONTROL: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Normal'); case 1: return Pel::tra('Low gain up'); case 2: return Pel::tra('High gain up'); case 3: return Pel::tra('Low gain down'); case 4: return Pel::tra('High gain down'); default: return $this->value[0]; } case PelTag::SATURATION: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Normal'); case 1: return Pel::tra('Low saturation'); case 2: return Pel::tra('High saturation'); default: return $this->value[0]; } case PelTag::CONTRAST: case PelTag::SHARPNESS: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Normal'); case 1: return Pel::tra('Soft'); case 2: return Pel::tra('Hard'); default: return $this->value[0]; } case PelTag::SUBJECT_DISTANCE_RANGE: //CC (e->components, 1, v); switch ($this->value[0]) { case 0: return Pel::tra('Unknown'); case 1: return Pel::tra('Macro'); case 2: return Pel::tra('Close view'); case 3: return Pel::tra('Distant view'); default: return $this->value[0]; } case PelTag::SUBJECT_AREA: switch ($this->components) { case 2: return Pel::fmt('(x,y) = (%d,%d)', $this->value[0], $this->value[1]); case 3: return Pel::fmt('Within distance %d of (x,y) = (%d,%d)', $this->value[0], $this->value[1], $this->value[2]); case 4: return Pel::fmt('Within rectangle (width %d, height %d) around (x,y) = (%d,%d)', $this->value[0], $this->value[1], $this->value[2], $this->value[3]); default: return Pel::fmt('Unexpected number of components (%d, expected 2, 3, or 4).', $this->components); } default: return parent::getText($brief); } }