wp/wp-includes/ID3/module.audio.flac.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 16 a86126ab1dd4
--- a/wp/wp-includes/ID3/module.audio.flac.php	Tue Jun 09 11:14:17 2015 +0000
+++ b/wp/wp-includes/ID3/module.audio.flac.php	Mon Oct 14 17:39:30 2019 +0200
@@ -135,7 +135,17 @@
 		if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) {
 			foreach ($info['flac']['PICTURE'] as $entry) {
 				if (!empty($entry['data'])) {
-					$info['flac']['comments']['picture'][] = array('image_mime'=>$entry['image_mime'], 'data'=>$entry['data']);
+					if (!isset($info['flac']['comments']['picture'])) {
+						$info['flac']['comments']['picture'] = array();
+					}
+					$comments_picture_data = array();
+					foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) {
+						if (isset($entry[$picture_key])) {
+							$comments_picture_data[$picture_key] = $entry[$picture_key];
+						}
+					}
+					$info['flac']['comments']['picture'][] = $comments_picture_data;
+					unset($comments_picture_data);
 				}
 			}
 		}
@@ -343,25 +353,25 @@
 		$info = &$this->getid3->info;
 
 		$picture['typeid']         = getid3_lib::BigEndian2Int($this->fread(4));
-		$picture['type']           = self::pictureTypeLookup($picture['typeid']);
+		$picture['picturetype']    = self::pictureTypeLookup($picture['typeid']);
 		$picture['image_mime']     = $this->fread(getid3_lib::BigEndian2Int($this->fread(4)));
 		$descr_length              = getid3_lib::BigEndian2Int($this->fread(4));
 		if ($descr_length) {
 			$picture['description'] = $this->fread($descr_length);
 		}
-		$picture['width']          = getid3_lib::BigEndian2Int($this->fread(4));
-		$picture['height']         = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['image_width']    = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['image_height']   = getid3_lib::BigEndian2Int($this->fread(4));
 		$picture['color_depth']    = getid3_lib::BigEndian2Int($this->fread(4));
 		$picture['colors_indexed'] = getid3_lib::BigEndian2Int($this->fread(4));
-		$data_length               = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['datalength']     = getid3_lib::BigEndian2Int($this->fread(4));
 
 		if ($picture['image_mime'] == '-->') {
-			$picture['data'] = $this->fread($data_length);
+			$picture['data'] = $this->fread($picture['datalength']);
 		} else {
 			$picture['data'] = $this->saveAttachment(
-				str_replace('/', '_', $picture['type']).'_'.$this->ftell(),
+				str_replace('/', '_', $picture['picturetype']).'_'.$this->ftell(),
 				$this->ftell(),
-				$data_length,
+				$picture['datalength'],
 				$picture['image_mime']);
 		}
 
@@ -440,4 +450,4 @@
 		return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved');
 	}
 
-}
\ No newline at end of file
+}