⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module.graphic.png.php

📁 一个用PHP编写的
💻 PHP
📖 第 1 页 / 共 2 页
字号:
					}					break;				case 'pHYs': // Physical Pixel Dimensions					$thisfile_png_chunk_type_text['header']                 = $chunk;					$thisfile_png_chunk_type_text['pixels_per_unit_x']      = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 4));					$thisfile_png_chunk_type_text['pixels_per_unit_y']      = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 4, 4));					$thisfile_png_chunk_type_text['unit_specifier']         = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 8, 1));					$thisfile_png_chunk_type_text['unit']                   = $this->PNGpHYsUnitLookup($thisfile_png_chunk_type_text['unit_specifier']);					break;				case 'sBIT': // Significant Bits					$thisfile_png_chunk_type_text['header'] = $chunk;					switch ($thisfile_png['IHDR']['raw']['color_type']) {						case 0:							$thisfile_png_chunk_type_text['significant_bits_gray']  = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 1));							break;						case 2:						case 3:							$thisfile_png_chunk_type_text['significant_bits_red']   = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 1));							$thisfile_png_chunk_type_text['significant_bits_green'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 1, 1));							$thisfile_png_chunk_type_text['significant_bits_blue']  = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 2, 1));							break;						case 4:							$thisfile_png_chunk_type_text['significant_bits_gray']  = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 1));							$thisfile_png_chunk_type_text['significant_bits_alpha'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 1, 1));							break;						case 6:							$thisfile_png_chunk_type_text['significant_bits_red']   = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 1));							$thisfile_png_chunk_type_text['significant_bits_green'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 1, 1));							$thisfile_png_chunk_type_text['significant_bits_blue']  = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 2, 1));							$thisfile_png_chunk_type_text['significant_bits_alpha'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 3, 1));							break;						default:							break;					}					break;				case 'sPLT': // Suggested Palette					$thisfile_png_chunk_type_text['header']                           = $chunk;					list($palettename, $otherdata)                                                = explode("\x00", $thisfile_png_chunk_type_text['header']['data'], 2);					$thisfile_png_chunk_type_text['palette_name']                     = $palettename;					$sPLToffset = 0;					$thisfile_png_chunk_type_text['sample_depth_bits']                = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 1));					$sPLToffset += 1;					$thisfile_png_chunk_type_text['sample_depth_bytes']               = $thisfile_png_chunk_type_text['sample_depth_bits'] / 8;					$paletteCounter = 0;					while ($sPLToffset < strlen($otherdata)) {						$thisfile_png_chunk_type_text['red'][$paletteCounter]       = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes']));						$sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes'];						$thisfile_png_chunk_type_text['green'][$paletteCounter]     = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes']));						$sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes'];						$thisfile_png_chunk_type_text['blue'][$paletteCounter]      = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes']));						$sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes'];						$thisfile_png_chunk_type_text['alpha'][$paletteCounter]     = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes']));						$sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes'];						$thisfile_png_chunk_type_text['frequency'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 2));						$sPLToffset += 2;						$paletteCounter++;					}					break;				case 'hIST': // Palette Histogram					$thisfile_png_chunk_type_text['header'] = $chunk;					$hISTcounter = 0;					while ($hISTcounter < strlen($thisfile_png_chunk_type_text['header']['data'])) {						$thisfile_png_chunk_type_text[$hISTcounter] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], $hISTcounter / 2, 2));						$hISTcounter += 2;					}					break;				case 'tIME': // Image Last-Modification Time					$thisfile_png_chunk_type_text['header'] = $chunk;					$thisfile_png_chunk_type_text['year']   = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 2));					$thisfile_png_chunk_type_text['month']  = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 2, 1));					$thisfile_png_chunk_type_text['day']    = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 3, 1));					$thisfile_png_chunk_type_text['hour']   = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 4, 1));					$thisfile_png_chunk_type_text['minute'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 5, 1));					$thisfile_png_chunk_type_text['second'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 6, 1));					$thisfile_png_chunk_type_text['unix']   = gmmktime($thisfile_png_chunk_type_text['hour'], $thisfile_png_chunk_type_text['minute'], $thisfile_png_chunk_type_text['second'], $thisfile_png_chunk_type_text['month'], $thisfile_png_chunk_type_text['day'], $thisfile_png_chunk_type_text['year']);					break;				case 'oFFs': // Image Offset					$thisfile_png_chunk_type_text['header']         = $chunk;					$thisfile_png_chunk_type_text['position_x']     = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 4), false, true);					$thisfile_png_chunk_type_text['position_y']     = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 4, 4), false, true);					$thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 8, 1));					$thisfile_png_chunk_type_text['unit']           = $this->PNGoFFsUnitLookup($thisfile_png_chunk_type_text['unit_specifier']);					break;				case 'pCAL': // Calibration Of Pixel Values					$thisfile_png_chunk_type_text['header']             = $chunk;					list($calibrationname, $otherdata)                              = explode("\x00", $thisfile_png_chunk_type_text['header']['data'], 2);					$thisfile_png_chunk_type_text['calibration_name']   = $calibrationname;					$pCALoffset = 0;					$thisfile_png_chunk_type_text['original_zero']      = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], $pCALoffset, 4), false, true);					$pCALoffset += 4;					$thisfile_png_chunk_type_text['original_max']       = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], $pCALoffset, 4), false, true);					$pCALoffset += 4;					$thisfile_png_chunk_type_text['equation_type']      = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], $pCALoffset, 1));					$pCALoffset += 1;					$thisfile_png_chunk_type_text['equation_type_text'] = $this->PNGpCALequationTypeLookup($thisfile_png_chunk_type_text['equation_type']);					$thisfile_png_chunk_type_text['parameter_count']    = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], $pCALoffset, 1));					$pCALoffset += 1;					$thisfile_png_chunk_type_text['parameters']         = explode("\x00", substr($thisfile_png_chunk_type_text['header']['data'], $pCALoffset));					break;				case 'sCAL': // Physical Scale Of Image Subject					$thisfile_png_chunk_type_text['header']         = $chunk;					$thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 1));					$thisfile_png_chunk_type_text['unit']           = $this->PNGsCALUnitLookup($thisfile_png_chunk_type_text['unit_specifier']);					list($pixelwidth, $pixelheight)                             = explode("\x00", substr($thisfile_png_chunk_type_text['header']['data'], 1));					$thisfile_png_chunk_type_text['pixel_width']    = $pixelwidth;					$thisfile_png_chunk_type_text['pixel_height']   = $pixelheight;					break;				case 'gIFg': // GIF Graphic Control Extension					$gIFgCounter = 0;					if (isset($thisfile_png_chunk_type_text) && is_array($thisfile_png_chunk_type_text)) {						$gIFgCounter = count($thisfile_png_chunk_type_text);					}					$thisfile_png_chunk_type_text[$gIFgCounter]['header']          = $chunk;					$thisfile_png_chunk_type_text[$gIFgCounter]['disposal_method'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 0, 1));					$thisfile_png_chunk_type_text[$gIFgCounter]['user_input_flag'] = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 1, 1));					$thisfile_png_chunk_type_text[$gIFgCounter]['delay_time']      = getid3_lib::BigEndian2Int(substr($thisfile_png_chunk_type_text['header']['data'], 2, 2));					break;				case 'gIFx': // GIF Application Extension					$gIFxCounter = 0;					if (isset($thisfile_png_chunk_type_text) && is_array($thisfile_png_chunk_type_text)) {						$gIFxCounter = count($thisfile_png_chunk_type_text);					}					$thisfile_png_chunk_type_text[$gIFxCounter]['header']                 = $chunk;					$thisfile_png_chunk_type_text[$gIFxCounter]['application_identifier'] = substr($thisfile_png_chunk_type_text['header']['data'],  0, 8);					$thisfile_png_chunk_type_text[$gIFxCounter]['authentication_code']    = substr($thisfile_png_chunk_type_text['header']['data'],  8, 3);					$thisfile_png_chunk_type_text[$gIFxCounter]['application_data']       = substr($thisfile_png_chunk_type_text['header']['data'], 11);					break;				case 'IDAT': // Image Data					$idatinformationfieldindex = 0;					if (isset($thisfile_png['IDAT']) && is_array($thisfile_png['IDAT'])) {						$idatinformationfieldindex = count($thisfile_png['IDAT']);					}					unset($chunk['data']);					$thisfile_png_chunk_type_text[$idatinformationfieldindex]['header'] = $chunk;					break;				case 'IEND': // Image Trailer					$thisfile_png_chunk_type_text['header'] = $chunk;					break;				default:					//unset($chunk['data']);					$thisfile_png_chunk_type_text['header'] = $chunk;					$ThisFileInfo['warning'][] = 'Unhandled chunk type: '.$chunk['type_text'];					break;			}		}		return true;	}	function PNGsRGBintentLookup($sRGB) {		static $PNGsRGBintentLookup = array(			0 => 'Perceptual',			1 => 'Relative colorimetric',			2 => 'Saturation',			3 => 'Absolute colorimetric'		);		return (isset($PNGsRGBintentLookup[$sRGB]) ? $PNGsRGBintentLookup[$sRGB] : 'invalid');	}	function PNGcompressionMethodLookup($compressionmethod) {		static $PNGcompressionMethodLookup = array(			0 => 'deflate/inflate'		);		return (isset($PNGcompressionMethodLookup[$compressionmethod]) ? $PNGcompressionMethodLookup[$compressionmethod] : 'invalid');	}	function PNGpHYsUnitLookup($unitid) {		static $PNGpHYsUnitLookup = array(			0 => 'unknown',			1 => 'meter'		);		return (isset($PNGpHYsUnitLookup[$unitid]) ? $PNGpHYsUnitLookup[$unitid] : 'invalid');	}	function PNGoFFsUnitLookup($unitid) {		static $PNGoFFsUnitLookup = array(			0 => 'pixel',			1 => 'micrometer'		);		return (isset($PNGoFFsUnitLookup[$unitid]) ? $PNGoFFsUnitLookup[$unitid] : 'invalid');	}	function PNGpCALequationTypeLookup($equationtype) {		static $PNGpCALequationTypeLookup = array(			0 => 'Linear mapping',			1 => 'Base-e exponential mapping',			2 => 'Arbitrary-base exponential mapping',			3 => 'Hyperbolic mapping'		);		return (isset($PNGpCALequationTypeLookup[$equationtype]) ? $PNGpCALequationTypeLookup[$equationtype] : 'invalid');	}	function PNGsCALUnitLookup($unitid) {		static $PNGsCALUnitLookup = array(			0 => 'meter',			1 => 'radian'		);		return (isset($PNGsCALUnitLookup[$unitid]) ? $PNGsCALUnitLookup[$unitid] : 'invalid');	}	function IHDRcalculateBitsPerSample($color_type, $bit_depth) {		switch ($color_type) {			case 0: // Each pixel is a grayscale sample.				return $bit_depth;				break;			case 2: // Each pixel is an R,G,B triple				return 3 * $bit_depth;				break;			case 3: // Each pixel is a palette index; a PLTE chunk must appear.				return $bit_depth;				break;			case 4: // Each pixel is a grayscale sample, followed by an alpha sample.				return 2 * $bit_depth;				break;			case 6: // Each pixel is an R,G,B triple, followed by an alpha sample.				return 4 * $bit_depth;				break;		}		return false;	}}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -