]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/ID3/module.audio.flac.php
WordPress 4.6.3-scripts
[autoinstalls/wordpress.git] / wp-includes / ID3 / module.audio.flac.php
index 6b9598c74170e520b3d0e50d01ca70d7a9681963..348cce328d22ff07e95cf24566e30368d40b4571 100644 (file)
@@ -3,6 +3,7 @@
 /// getID3() by James Heinrich <info@getid3.org>               //
 //  available at http://getid3.sourceforge.net                 //
 //            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
 /////////////////////////////////////////////////////////////////
 // See readme.txt for more details                             //
 /////////////////////////////////////////////////////////////////
@@ -134,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);
                                }
                        }
                }
@@ -342,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']);
                }