]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/ID3/module.audio.flac.php
WordPress 4.3
[autoinstalls/wordpress.git] / wp-includes / ID3 / module.audio.flac.php
index 8fa0f4c68a39b21e32ee9db60cc7b4563a696414..348cce328d22ff07e95cf24566e30368d40b4571 100644 (file)
@@ -135,7 +135,17 @@ class getid3_flac extends getid3_handler
                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 @@ class getid3_flac extends getid3_handler
                $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 @@ class getid3_flac extends getid3_handler
                return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved');
        }
 
-}
\ No newline at end of file
+}