1
이 코드를 사용하여 MP3 파일의 ID3 정보를 가져옵니다.MP3에서 앨범 아트 가져 오기 PHP
<?php
class CMP3File {
var $title;var $artist;var $album;var $year;var $comment;var $genre;
function getid3 ($file) {
if (file_exists($file)) {
$id_start=filesize($file)-128;
$fp=fopen($file,"r");
fseek($fp,$id_start);
$tag=fread($fp,3);
if ($tag == "TAG") {
$this->title=fread($fp,30);
$this->artist=fread($fp,30);
$this->album=fread($fp,30);
$this->year=fread($fp,4);
$this->comment=fread($fp,30);
$this->genre=fread($fp,1);
fclose($fp);
return true;
} else {
fclose($fp);
return false;
}
} else { return false; }
}
}
?>
다음 코드를 사용하여이 코드를 호출합니다.
include ("CMP3File.php");
$filename="music_file.mp3";
$mp3file=new CMP3File;
$mp3file->getid3($filename);
echo "Title: $mp3file->title<br>\n";
echo "Artist: $mp3file->artist<br>\n";
echo "Album: $mp3file->album<br>\n";
echo "Year: $mp3file->year<br>\n";
echo "Comment: $mp3file->comment<br>\n";
echo "Genre: " . Ord($mp3file->genre) . "<br>\n";
앨범 아트를 이미지로 가져 와서 반향시킬 수있는 방법이 있습니까?
그는 자신이 시도한 코드를 게시하고 표지 이미지를 포함시키는 방법을 알고 싶어합니다. 그게 너무 지역화 된거야? – DanMan