本文整理匯總了PHP中getid3_lib::ImageTypesLookup方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::ImageTypesLookup方法的具體用法?PHP getid3_lib::ImageTypesLookup怎麽用?PHP getid3_lib::ImageTypesLookup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類getid3_lib
的用法示例。
在下文中一共展示了getid3_lib::ImageTypesLookup方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ParseID3v2Frame
//.........這裏部分代碼省略.........
}
}
if ($id3v2_majorversion > 2 && strlen($parsedFrame['data']) > $frame_offset) {
$frame_terminatorpos = @strpos($parsedFrame['data'], "", $frame_offset);
$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
if (ord($frame_mimetype) === 0) {
$frame_mimetype = '';
}
$frame_offset = $frame_terminatorpos + strlen("");
}
$frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1));
$frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
$frame_terminatorpos++;
// @strpos() fooled because 2nd byte of Unicode chars are often 0x00
}
$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
if (ord($frame_description) === 0) {
$frame_description = '';
}
$parsedFrame['encodingid'] = $frame_textencoding;
$parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
if ($id3v2_majorversion == 2) {
$parsedFrame['imagetype'] = $frame_imagetype;
} else {
$parsedFrame['mime'] = $frame_mimetype;
}
$parsedFrame['picturetypeid'] = $frame_picturetype;
$parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype);
$parsedFrame['description'] = $frame_description;
$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
$imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data']);
if ($imagechunkcheck[2] >= 1 && $imagechunkcheck[2] <= 3) {
$parsedFrame['image_mime'] = 'image/' . getid3_lib::ImageTypesLookup($imagechunkcheck[2]);
if ($imagechunkcheck[0]) {
$parsedFrame['image_width'] = $imagechunkcheck[0];
}
if ($imagechunkcheck[1]) {
$parsedFrame['image_height'] = $imagechunkcheck[1];
}
$parsedFrame['image_bytes'] = strlen($parsedFrame['data']);
}
} elseif ($id3v2_majorversion >= 3 && $parsedFrame['frame_name'] == 'GEOB' || $id3v2_majorversion == 2 && $parsedFrame['frame_name'] == 'GEO') {
// 4.16 GEO General encapsulated object
// There may be more than one 'GEOB' frame in each tag,
// but only one with the same content descriptor
// <Header for 'General encapsulated object', ID: 'GEOB'>
// Text encoding $xx
// MIME type <text string> $00
// Filename <text string according to encoding> $00 (00)
// Content description <text string according to encoding> $00 (00)
// Encapsulated object <binary data>
$frame_offset = 0;
$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
if ($id3v2_majorversion <= 3 && $frame_textencoding > 1 || $id3v2_majorversion == 4 && $frame_textencoding > 3) {
$ThisFileInfo['warning'][] = 'Invalid text encoding byte (' . $frame_textencoding . ') in frame "' . $parsedFrame['frame_name'] . '" - defaulting to ISO-8859-1 encoding';
}
$frame_terminatorpos = @strpos($parsedFrame['data'], "", $frame_offset);
$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
if (ord($frame_mimetype) === 0) {
$frame_mimetype = '';
}
$frame_offset = $frame_terminatorpos + strlen("");
$frame_terminatorpos = @strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
$frame_terminatorpos++;
示例2: table_var_dump
function table_var_dump($variable, $wrap_in_td = false)
{
$returnstring = '';
switch (gettype($variable)) {
case 'array':
$returnstring .= $wrap_in_td ? '<td>' : '';
$returnstring .= '<table class="dump" cellspacing="0" cellpadding="2">';
foreach ($variable as $key => $value) {
$returnstring .= '<tr><td valign="top"><b>' . str_replace("", ' ', $key) . '</b></td>';
$returnstring .= '<td valign="top">' . gettype($value);
if (is_array($value)) {
$returnstring .= ' (' . count($value) . ')';
} elseif (is_string($value)) {
$returnstring .= ' (' . strlen($value) . ')';
}
if ($key == 'data' && isset($variable['image_mime']) && isset($variable['dataoffset'])) {
$imageinfo = array();
$imagechunkcheck = getid3_lib::GetDataImageSize($value, $imageinfo);
$DumpedImageSRC = (!empty($_REQUEST['filename']) ? $_REQUEST['filename'] : '.getid3') . '.' . $variable['dataoffset'] . '.' . getid3_lib::ImageTypesLookup($imagechunkcheck[2]);
if ($tempimagefile = @fopen($DumpedImageSRC, 'wb')) {
fwrite($tempimagefile, $value);
fclose($tempimagefile);
}
$returnstring .= '</td><td><img src="' . $_SERVER['PHP_SELF'] . '?showfile=' . urlencode($DumpedImageSRC) . '&md5=' . md5_file($DumpedImageSRC) . '" width="' . $imagechunkcheck[0] . '" height="' . $imagechunkcheck[1] . '"></td></tr>';
} else {
$returnstring .= '</td>' . table_var_dump($value, true) . '</tr>';
}
}
$returnstring .= '</table>';
$returnstring .= $wrap_in_td ? '</td>' : '';
break;
case 'boolean':
$returnstring .= ($wrap_in_td ? '<td class="dump_boolean">' : '') . ($variable ? 'TRUE' : 'FALSE') . ($wrap_in_td ? '</td>' : '');
break;
case 'integer':
$returnstring .= ($wrap_in_td ? '<td class="dump_integer">' : '') . $variable . ($wrap_in_td ? '</td>' : '');
break;
case 'double':
case 'float':
$returnstring .= ($wrap_in_td ? '<td class="dump_double">' : '') . $variable . ($wrap_in_td ? '</td>' : '');
break;
case 'object':
case 'null':
$returnstring .= ($wrap_in_td ? '<td>' : '') . string_var_dump($variable) . ($wrap_in_td ? '</td>' : '');
break;
case 'string':
$variable = str_replace("", ' ', $variable);
$varlen = strlen($variable);
for ($i = 0; $i < $varlen; $i++) {
if (ereg('[' . "\n\r" . ' -;0-9A-Za-z]', $variable[$i])) {
$returnstring .= $variable[$i];
} else {
$returnstring .= '&#' . str_pad(ord($variable[$i]), 3, '0', STR_PAD_LEFT) . ';';
}
}
$returnstring = ($wrap_in_td ? '<td class="dump_string">' : '') . nl2br($returnstring) . ($wrap_in_td ? '</td>' : '');
break;
default:
$imageinfo = array();
$imagechunkcheck = getid3_lib::GetDataImageSize($variable, $imageinfo);
if ($imagechunkcheck[2] >= 1 && $imagechunkcheck[2] <= 3) {
$returnstring .= $wrap_in_td ? '<td>' : '';
$returnstring .= '<table class="dump" cellspacing="0" cellpadding="2">';
$returnstring .= '<tr><td><b>type</b></td><td>' . getid3_lib::ImageTypesLookup($imagechunkcheck[2]) . '</td></tr>';
$returnstring .= '<tr><td><b>width</b></td><td>' . number_format($imagechunkcheck[0]) . ' px</td></tr>';
$returnstring .= '<tr><td><b>height</b></td><td>' . number_format($imagechunkcheck[1]) . ' px</td></tr>';
$returnstring .= '<tr><td><b>size</b></td><td>' . number_format(strlen($variable)) . ' bytes</td></tr></table>';
$returnstring .= $wrap_in_td ? '</td>' : '';
} else {
$returnstring .= ($wrap_in_td ? '<td>' : '') . nl2br(htmlspecialchars(str_replace("", ' ', $variable))) . ($wrap_in_td ? '</td>' : '');
}
break;
}
return $returnstring;
}
示例3: table_var_dump
function table_var_dump($variable, $wrap_in_td = false, $encoding = 'ISO-8859-1')
{
$returnstring = '';
switch (gettype($variable)) {
case 'array':
$returnstring .= $wrap_in_td ? '<td>' : '';
$returnstring .= '<table class="dump" cellspacing="0" cellpadding="2">';
foreach ($variable as $key => $value) {
$returnstring .= '<tr><td valign="top"><b>' . str_replace("", ' ', $key) . '</b></td>' . "\n";
$returnstring .= '<td valign="top">' . gettype($value);
if (is_array($value)) {
$returnstring .= ' (' . count($value) . ')';
} elseif (is_string($value)) {
$returnstring .= ' (' . strlen($value) . ')';
}
//if (($key == 'data') && isset($variable['image_mime']) && isset($variable['dataoffset'])) {
if ($key == 'data' && isset($variable['image_mime'])) {
$imageinfo = array();
$imagechunkcheck = getid3_lib::GetDataImageSize($value, $imageinfo);
$returnstring .= '</td>' . "\n" . '<td><img src="data:' . $variable['image_mime'] . ';base64,' . base64_encode($value) . '" width="' . $imagechunkcheck[0] . '" height="' . $imagechunkcheck[1] . '"></td></tr>' . "\n";
} else {
$returnstring .= '</td>' . "\n" . table_var_dump($value, true, $encoding) . '</tr>' . "\n";
}
}
$returnstring .= '</table>' . "\n";
$returnstring .= $wrap_in_td ? '</td>' . "\n" : '';
break;
case 'boolean':
$returnstring .= ($wrap_in_td ? '<td class="dump_boolean">' : '') . ($variable ? 'TRUE' : 'FALSE') . ($wrap_in_td ? '</td>' . "\n" : '');
break;
case 'integer':
$returnstring .= ($wrap_in_td ? '<td class="dump_integer">' : '') . $variable . ($wrap_in_td ? '</td>' . "\n" : '');
break;
case 'double':
case 'float':
$returnstring .= ($wrap_in_td ? '<td class="dump_double">' : '') . $variable . ($wrap_in_td ? '</td>' . "\n" : '');
break;
case 'object':
case 'null':
$returnstring .= ($wrap_in_td ? '<td>' : '') . string_var_dump($variable) . ($wrap_in_td ? '</td>' . "\n" : '');
break;
case 'string':
//$variable = str_replace("\x00", ' ', $variable);
//$varlen = strlen($variable);
//for ($i = 0; $i < $varlen; $i++) {
// $returnstring .= htmlentities($variable{$i}, ENT_QUOTES, $encoding);
//}
$returnstring = htmlentities($variable, ENT_QUOTES, $encoding);
$returnstring = ($wrap_in_td ? '<td class="dump_string">' : '') . nl2br($returnstring) . ($wrap_in_td ? '</td>' . "\n" : '');
break;
default:
$imageinfo = array();
$imagechunkcheck = getid3_lib::GetDataImageSize($variable, $imageinfo);
if ($imagechunkcheck[2] >= 1 && $imagechunkcheck[2] <= 3) {
$returnstring .= $wrap_in_td ? '<td>' : '';
$returnstring .= '<table class="dump" cellspacing="0" cellpadding="2">';
$returnstring .= '<tr><td><b>type</b></td><td>' . getid3_lib::ImageTypesLookup($imagechunkcheck[2]) . '</td></tr>' . "\n";
$returnstring .= '<tr><td><b>width</b></td><td>' . number_format($imagechunkcheck[0]) . ' px</td></tr>' . "\n";
$returnstring .= '<tr><td><b>height</b></td><td>' . number_format($imagechunkcheck[1]) . ' px</td></tr>' . "\n";
$returnstring .= '<tr><td><b>size</b></td><td>' . number_format(strlen($variable)) . ' bytes</td></tr></table>' . "\n";
$returnstring .= $wrap_in_td ? '</td>' . "\n" : '';
} else {
$returnstring .= ($wrap_in_td ? '<td>' : '') . nl2br(htmlspecialchars(str_replace("", ' ', $variable))) . ($wrap_in_td ? '</td>' . "\n" : '');
}
break;
}
return $returnstring;
}
示例4: ParseID3v2Frame
//.........這裏部分代碼省略.........
$frame_mimetype = '';
}
$frame_offset = $frame_terminatorpos + strlen("");
}
$frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1));
if ($frame_offset >= $parsedFrame['datalength']) {
$info['warning'][] = 'data portion of APIC frame is missing at offset ' . ($parsedFrame['dataoffset'] + 8 + $frame_offset);
} else {
$frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset);
if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) {
$frame_terminatorpos++;
// strpos() fooled because 2nd byte of Unicode chars are often 0x00
}
$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
if (ord($frame_description) === 0) {
$frame_description = '';
}
$parsedFrame['encodingid'] = $frame_textencoding;
$parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
if ($id3v2_majorversion == 2) {
$parsedFrame['imagetype'] = $frame_imagetype;
} else {
$parsedFrame['mime'] = $frame_mimetype;
}
$parsedFrame['picturetypeid'] = $frame_picturetype;
$parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype);
$parsedFrame['description'] = $frame_description;
$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator));
$parsedFrame['datalength'] = strlen($parsedFrame['data']);
$parsedFrame['image_mime'] = '';
$imageinfo = array();
$imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo);
if ($imagechunkcheck[2] >= 1 && $imagechunkcheck[2] <= 3) {
$parsedFrame['image_mime'] = 'image/' . getid3_lib::ImageTypesLookup($imagechunkcheck[2]);
if ($imagechunkcheck[0]) {
$parsedFrame['image_width'] = $imagechunkcheck[0];
}
if ($imagechunkcheck[1]) {
$parsedFrame['image_height'] = $imagechunkcheck[1];
}
}
do {
if ($this->getid3->option_save_attachments === false) {
// skip entirely
unset($parsedFrame['data']);
break;
}
if ($this->getid3->option_save_attachments === true) {
// great
/*
} elseif (is_int($this->getid3->option_save_attachments)) {
if ($this->getid3->option_save_attachments < $parsedFrame['data_length']) {
// too big, skip
$info['warning'][] = 'attachment at '.$frame_offset.' is too large to process inline ('.number_format($parsedFrame['data_length']).' bytes)';
unset($parsedFrame['data']);
break;
}
*/
} elseif (is_string($this->getid3->option_save_attachments)) {
$dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR);
if (!is_dir($dir) || !is_writable($dir)) {
// cannot write, skip
$info['warning'][] = 'attachment at ' . $frame_offset . ' cannot be saved to "' . $dir . '" (not writable)';
unset($parsedFrame['data']);
break;
}
示例5: table_var_dump
public static function table_var_dump(&$variable, $wrap_in_td = false, $show_types = false, $level = 0)
{
$returnstring = '';
if (is_array($variable)) {
$returnstring .= $wrap_in_td ? '' : '';
$returnstring .= '<ul class="dump_array dump_level_' . sprintf('%02u', $level) . '">';
foreach ($variable as $key => &$value) {
// Assign an extra class representing the (rounded) width in number of characters 'or more':
// You can use this as a width approximation in pixels to style (very) wide items. It saves
// a long run through all the nodes in JS, just to measure the actual width and correct any
// overlap occurring in there.
$keylen = strlen($key);
$threshold = 10;
$overlarge_key_class = '';
while ($keylen >= $threshold) {
$overlarge_key_class .= ' overlarger' . sprintf('%04d', $threshold);
$threshold *= 1.6;
}
$returnstring .= '<li><span class="key' . $overlarge_key_class . '">' . $key . '</span>';
$tstring = '';
if ($show_types) {
$tstring = '<span class="type">' . gettype($value);
if (is_array($value)) {
$tstring .= ' (' . count($value) . ')';
} elseif (is_string($value)) {
$tstring .= ' (' . strlen($value) . ')';
}
$tstring = '</span>';
}
switch ((string) $key) {
case 'filesize':
$returnstring .= '<span class="dump_seconds">' . $tstring . self::fmt_bytecount($value) . ($value >= 1024 ? ' (' . $value . ' bytes)' : '') . '</span></li>';
continue 2;
case 'playtime seconds':
$returnstring .= '<span class="dump_seconds">' . $tstring . number_format($value, 1) . ' s</span></li>';
continue 2;
case 'compression ratio':
$returnstring .= '<span class="dump_compression_ratio">' . $tstring . number_format($value * 100, 1) . '%</span></li>';
continue 2;
case 'bitrate':
case 'bit rate':
case 'avg bit rate':
case 'max bit rate':
case 'max bitrate':
case 'sample rate':
case 'sample rate2':
case 'samples per sec':
case 'avg bytes per sec':
$returnstring .= '<span class="dump_rate">' . $tstring . self::fmt_bytecount($value) . '/s</span></li>';
continue 2;
case 'bytes per minute':
$returnstring .= '<span class="dump_rate">' . $tstring . self::fmt_bytecount($value) . '/min</span></li>';
continue 2;
}
$returnstring .= FileManagerUtility::table_var_dump($value, true, $show_types, $level + 1) . '</li>';
}
$returnstring .= '</ul>';
$returnstring .= $wrap_in_td ? '' : '';
} else {
if (is_bool($variable)) {
$returnstring .= ($wrap_in_td ? '<span class="dump_boolean">' : '') . ($variable ? 'TRUE' : 'FALSE') . ($wrap_in_td ? '</span>' : '');
} else {
if (is_int($variable)) {
$returnstring .= ($wrap_in_td ? '<span class="dump_integer">' : '') . $variable . ($wrap_in_td ? '</span>' : '');
} else {
if (is_float($variable)) {
$returnstring .= ($wrap_in_td ? '<span class="dump_double">' : '') . $variable . ($wrap_in_td ? '</span>' : '');
} else {
if (is_object($variable) && isset($variable->id3_procsupport_obj)) {
if (isset($variable->metadata) && isset($variable->imagedata)) {
// an embedded image (MP3 et al)
$returnstring .= $wrap_in_td ? '<div class="dump_embedded_image">' : '';
$returnstring .= '<table class="dump_image">';
$returnstring .= '<tr><td><b>type</b></td><td>' . getid3_lib::ImageTypesLookup($variable->metadata[2]) . '</td></tr>';
$returnstring .= '<tr><td><b>width</b></td><td>' . number_format($variable->metadata[0]) . ' px</td></tr>';
$returnstring .= '<tr><td><b>height</b></td><td>' . number_format($variable->metadata[1]) . ' px</td></tr>';
$returnstring .= '<tr><td><b>size</b></td><td>' . number_format(strlen($variable->imagedata)) . ' bytes</td></tr></table>';
$returnstring .= '<img src="data:' . $variable->metadata['mime'] . ';base64,' . base64_encode($variable->imagedata) . '" width="' . $variable->metadata[0] . '" height="' . $variable->metadata[1] . '">';
$returnstring .= $wrap_in_td ? '</div>' : '';
} else {
if (isset($variable->binarydata_mode)) {
$returnstring .= $wrap_in_td ? '<span class="dump_binary_data">' : '';
if ($variable->binarydata_mode == 'procd') {
$returnstring .= '<i>' . self::table_var_dump($variable->binarydata, false, false, $level + 1) . '</i>';
} else {
$temp = unpack('H*', $variable->binarydata);
$temp = str_split($temp[1], 8);
$returnstring .= '<i>' . self::table_var_dump(implode(' ', $temp), false, false, $level + 1) . '</i>';
}
$returnstring .= $wrap_in_td ? '</span>' : '';
} else {
$returnstring .= ($wrap_in_td ? '<span class="dump_object">' : '') . print_r($variable, true) . ($wrap_in_td ? '</span>' : '');
}
}
} else {
if (is_object($variable)) {
$returnstring .= ($wrap_in_td ? '<span class="dump_object">' : '') . print_r($variable, true) . ($wrap_in_td ? '</span>' : '');
} else {
if (is_null($variable)) {
$returnstring .= ($wrap_in_td ? '<span class="dump_null">' : '') . '(null)' . ($wrap_in_td ? '</span>' : '');
//.........這裏部分代碼省略.........