Forum Moderators: coopster
public function getInfo(){
if ($this->getPath()!= ''){
$mp3 = @fopen($this->getPath(),"r");
$header = @fread($mp3,10);
if (!$header) {
$this->last_error_num = 2;
return false;
die();
}
if (substr($header,0,3)!= "ID3"){
$this->last_error_num = 3;
return false;
die();
}
$header = bin2hex($header);
$version = base_convert(substr($header,6,2),16,10).".".base_convert(substr($header,8,2),16,10);
$flags = base_convert(substr($header,10,2),16,2);
$flags = str_pad($flags,8,0,STR_PAD_LEFT);
if ($flags[7] == 1){
//echo('with Unsynchronisation<br>');
}
if ($flags[6] == 1){
//echo('with Extended header<br>');
}
if ($flags[5] == 1){//Esperimental tag
$this->last_error_num = 4;
return false;
die();
}
$total = $this->get_frame_size(substr($header,12,8));
$text = @fread($mp3,$total);
fclose($mp3);
$this->extractTags($text,$this->_tags);
}
else{
$this->last_error_num = 1;//file not set
return false;
die();
}
return true;
}