GetDataImageSize example

                    $flac = new getid3_flac($this->getid3);
                    $flac->setStringMode(base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']));
                    $flac->parsePICTURE();
                    $info['ogg']['comments']['picture'][] = $flac->getid3->info['flac']['PICTURE'][0];
                    unset($flac);

                } elseif ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'COVERART') {

                    $data = base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']);
                    $this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure');
                    /** @todo use 'coverartmime' where available */
                    $imageinfo = getid3_lib::GetDataImageSize($data);
                    if ($imageinfo === false || !isset($imageinfo['mime'])) {
                        $this->warning('COVERART vorbiscomment tag contains invalid image');
                        continue;
                    }

                    $ogg = new self($this->getid3);
                    $ogg->setStringMode($data);
                    $info['ogg']['comments']['picture'][] = array(
                        'image_mime'   => $imageinfo['mime'],
                        'datalength'   => strlen($data),
                        'picturetype'  => 'cover art',
                        
$parsedFrame['imagetype'] = isset($frame_imagetype) ? $frame_imagetype : null;
                } else {
                    $parsedFrame['mime']      = isset($frame_mimetype) ? $frame_mimetype : null;
                }
                $parsedFrame['picturetypeid'] = $frame_picturetype;
                $parsedFrame['picturetype']   = $this->APICPictureTypeLookup($frame_picturetype);
                $parsedFrame['data']          = substr($parsedFrame['data']$frame_terminatorpos + strlen($frame_textencoding_terminator));
                $parsedFrame['datalength']    = strlen($parsedFrame['data']);

                $parsedFrame['image_mime']    = '';
                $imageinfo = array();
                if ($imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data']$imageinfo)) {
                    if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) {
                        $parsedFrame['image_mime']       = image_type_to_mime_type($imagechunkcheck[2]);
                        if ($imagechunkcheck[0]) {
                            $parsedFrame['image_width']  = $imagechunkcheck[0];
                        }
                        if ($imagechunkcheck[1]) {
                            $parsedFrame['image_height'] = $imagechunkcheck[1];
                        }
                    }
                }

                
do {
            $next_byte_pair = substr($data$offset, 2);
            $offset += 2;
            $WMpicture['image_description'] .= $next_byte_pair;
        } while ($next_byte_pair !== "\x00\x00");

        $WMpicture['dataoffset'] = $offset;
        $WMpicture['data'] = substr($data$offset);

        $imageinfo = array();
        $WMpicture['image_mime'] = '';
        $imagechunkcheck = getid3_lib::GetDataImageSize($WMpicture['data']$imageinfo);
        unset($imageinfo);
        if (!empty($imagechunkcheck)) {
            $WMpicture['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
        }
        if (!isset($this->getid3->info['asf']['comments']['picture'])) {
            $this->getid3->info['asf']['comments']['picture'] = array();
        }
        $this->getid3->info['asf']['comments']['picture'][] = array('data'=>$WMpicture['data'], 'image_mime'=>$WMpicture['image_mime']);

        return $WMpicture;
    }

    
                    if (is_array($thisfile_ape_items_current['data'])) {
                        $this->warning('APEtag "'.$item_key.'" should be flagged as Binary data, but was incorrectly flagged as UTF-8');
                        $thisfile_ape_items_current['data'] = implode("\x00", $thisfile_ape_items_current['data']);
                    }
                    list($thisfile_ape_items_current['filename']$thisfile_ape_items_current['data']) = explode("\x00", $thisfile_ape_items_current['data'], 2);
                    $thisfile_ape_items_current['data_offset'] = $thisfile_ape_items_current['offset'] + strlen($thisfile_ape_items_current['filename']."\x00");
                    $thisfile_ape_items_current['data_length'] = strlen($thisfile_ape_items_current['data']);

                    do {
                        $thisfile_ape_items_current['image_mime'] = '';
                        $imageinfo = array();
                        $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data']$imageinfo);
                        if (($imagechunkcheck === false) || !isset($imagechunkcheck[2])) {
                            $this->warning('APEtag "'.$item_key.'" contains invalid image data');
                            break;
                        }
                        $thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);

                        if ($this->inline_attachments === false) {
                            // skip entirely                             unset($thisfile_ape_items_current['data']);
                            break;
                        }
                        
Home | Imprint | This part of the site doesn't use cookies.