本文整理汇总了PHP中Pel::fmt方法的典型用法代码示例。如果您正苦于以下问题:PHP Pel::fmt方法的具体用法?PHP Pel::fmt怎么用?PHP Pel::fmt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pel
的用法示例。
在下文中一共展示了Pel::fmt方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
/**
* 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;
}
示例2: getText
/**
* 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);
}
}
示例3: getText
/**
* 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);
}
}
示例4: __toString
/**
* 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;
}
示例5: getSize
/**
* 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);
}
}
示例6: __toString
/**
* 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;
}
示例7: getTitle
//.........这里部分代码省略.........
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';
示例8: __toString
/**
* 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;
}
示例9: getText
//.........这里部分代码省略.........
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);
}
}
示例10: getText
/**
* 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);
}
}
示例11: getDescription
/**
* 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);
//.........这里部分代码省略.........
示例12: __toString
/**
* 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));
}