wp/wp-includes/ID3/module.audio.flac.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 16 a86126ab1dd4
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
   133 
   133 
   134 		// copy attachments to 'comments' array if nesesary
   134 		// copy attachments to 'comments' array if nesesary
   135 		if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) {
   135 		if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) {
   136 			foreach ($info['flac']['PICTURE'] as $entry) {
   136 			foreach ($info['flac']['PICTURE'] as $entry) {
   137 				if (!empty($entry['data'])) {
   137 				if (!empty($entry['data'])) {
   138 					$info['flac']['comments']['picture'][] = array('image_mime'=>$entry['image_mime'], 'data'=>$entry['data']);
   138 					if (!isset($info['flac']['comments']['picture'])) {
       
   139 						$info['flac']['comments']['picture'] = array();
       
   140 					}
       
   141 					$comments_picture_data = array();
       
   142 					foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) {
       
   143 						if (isset($entry[$picture_key])) {
       
   144 							$comments_picture_data[$picture_key] = $entry[$picture_key];
       
   145 						}
       
   146 					}
       
   147 					$info['flac']['comments']['picture'][] = $comments_picture_data;
       
   148 					unset($comments_picture_data);
   139 				}
   149 				}
   140 			}
   150 			}
   141 		}
   151 		}
   142 
   152 
   143 		if (isset($info['flac']['STREAMINFO'])) {
   153 		if (isset($info['flac']['STREAMINFO'])) {
   341 	*/
   351 	*/
   342 	public function parsePICTURE() {
   352 	public function parsePICTURE() {
   343 		$info = &$this->getid3->info;
   353 		$info = &$this->getid3->info;
   344 
   354 
   345 		$picture['typeid']         = getid3_lib::BigEndian2Int($this->fread(4));
   355 		$picture['typeid']         = getid3_lib::BigEndian2Int($this->fread(4));
   346 		$picture['type']           = self::pictureTypeLookup($picture['typeid']);
   356 		$picture['picturetype']    = self::pictureTypeLookup($picture['typeid']);
   347 		$picture['image_mime']     = $this->fread(getid3_lib::BigEndian2Int($this->fread(4)));
   357 		$picture['image_mime']     = $this->fread(getid3_lib::BigEndian2Int($this->fread(4)));
   348 		$descr_length              = getid3_lib::BigEndian2Int($this->fread(4));
   358 		$descr_length              = getid3_lib::BigEndian2Int($this->fread(4));
   349 		if ($descr_length) {
   359 		if ($descr_length) {
   350 			$picture['description'] = $this->fread($descr_length);
   360 			$picture['description'] = $this->fread($descr_length);
   351 		}
   361 		}
   352 		$picture['width']          = getid3_lib::BigEndian2Int($this->fread(4));
   362 		$picture['image_width']    = getid3_lib::BigEndian2Int($this->fread(4));
   353 		$picture['height']         = getid3_lib::BigEndian2Int($this->fread(4));
   363 		$picture['image_height']   = getid3_lib::BigEndian2Int($this->fread(4));
   354 		$picture['color_depth']    = getid3_lib::BigEndian2Int($this->fread(4));
   364 		$picture['color_depth']    = getid3_lib::BigEndian2Int($this->fread(4));
   355 		$picture['colors_indexed'] = getid3_lib::BigEndian2Int($this->fread(4));
   365 		$picture['colors_indexed'] = getid3_lib::BigEndian2Int($this->fread(4));
   356 		$data_length               = getid3_lib::BigEndian2Int($this->fread(4));
   366 		$picture['datalength']     = getid3_lib::BigEndian2Int($this->fread(4));
   357 
   367 
   358 		if ($picture['image_mime'] == '-->') {
   368 		if ($picture['image_mime'] == '-->') {
   359 			$picture['data'] = $this->fread($data_length);
   369 			$picture['data'] = $this->fread($picture['datalength']);
   360 		} else {
   370 		} else {
   361 			$picture['data'] = $this->saveAttachment(
   371 			$picture['data'] = $this->saveAttachment(
   362 				str_replace('/', '_', $picture['type']).'_'.$this->ftell(),
   372 				str_replace('/', '_', $picture['picturetype']).'_'.$this->ftell(),
   363 				$this->ftell(),
   373 				$this->ftell(),
   364 				$data_length,
   374 				$picture['datalength'],
   365 				$picture['image_mime']);
   375 				$picture['image_mime']);
   366 		}
   376 		}
   367 
   377 
   368 		$info['flac']['PICTURE'][] = $picture;
   378 		$info['flac']['PICTURE'][] = $picture;
   369 
   379