Forum Moderators: coopster

Message Too Old, No Replies

php getting id3 tags

         

electricocean

8:40 pm on Oct 27, 2005 (gmt 0)

10+ Year Member



Hi,

I am having problems id3_get_tag(). On the php website it says i need to have PECL installed. How do i know if PECL is installed?

thanks,
electricocean

5x54u

4:10 pm on Oct 28, 2005 (gmt 0)

10+ Year Member



create a page called testphp.php

on that page; place this code:

<?php

phpinfo();

?>

Upload the page and view in broswer. Under the Section SQlite see if PECL is enabled. If not enableed u may enable in your ini file. What version are you using? I believe its enabled by default

electricocean

12:49 am on Oct 30, 2005 (gmt 0)

10+ Year Member



Hi, i looked in my phpinfo page and there isn't even a section for SQlite.

I am using a free server so i can't change any of the php.ini files or what ever.

Is there another way to read id3 tags?

thanks,

electricocean

electricocean

2:15 am on Oct 30, 2005 (gmt 0)

10+ Year Member



I found this OOP code to get id3 tags and it isn't working and i don't under stand it

here it is:

class id3reader{ // id3reader declaration

//properties
var $title;
var $artist;
var $album;
var $comment;


function getid3($file){ // read the ID3 tag from an MP3 file
if (file_exists($file)){ //after verifying the file exists,
$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->comment = fread($fp, 30);
fclose($fp);
return true;
}
else{ //there is no ID3 tag in the file
fclose($fp);
return false;
}
}
else{ //the file doesn't exist
return false;
}
}
}

and displaying it:

$fid3 = new id3reader();//id3_get_tag($fname, ID3_V2_2);
$fid3->getid3($fname);
$title = $fid3->title;
$artist = $fid3->artist;
$album = $fid3->album;
$comment = $fid3->comment;//... and display it all

Would this work? I amoutputting it as rss and the atrributes don't show up.

thanks,
electricocean

electricocean

6:33 am on Nov 1, 2005 (gmt 0)

10+ Year Member



anybody?

dreamcatcher

10:16 am on Nov 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The PHP Classes Repository has some ready made classes for reading ID3 data, so try there, you might find something:

[phpclasses.org...]

Good luck.

dc