need some help for getid3 plss.
Started on the old forum in November 2020 · view the original in the archive · old links redirect here
Something on the lines of:
<?
function scanID3($file)
{
require_once 'libraries/getid3/getid3.php'; //change to getid3 location
$res = false;
$getID3 = new getID3();
$id3 = $getID3->analyze($file);
if (isset($id3["fileformat"]) && $id3["fileformat"] == "mp3") {
$res = array();
$res["file"] = $file;
$res["album"] = $id3["tags"]["id3v2"]["album"][0];
$res["title"] = $id3["tags"]["id3v2"]["title"][0];
if (isset($id3["tags"]["id3v2"]["artist"][0])) {
$res["artist"] = $id3["tags"]["id3v2"]["artist"][0];
} else {
$res["artist"] = "Unknown";
}
$res["trackNumber"] = $id3["tags"]["id3v2"]["track_number"][0];
$res["link"] = str_replace(["_aaID_", "_trackID_"], [md5($res["artist"] . "_" . $res["album"]), $res["trackNumber"]], $this->config["link"]);
if (strpos($res["trackNumber"], "/")) {
$res["trackNumber"] = substr($res["trackNumber"], 0, strpos($res["trackNumber"], "/"));
}
$res["trackNumber"] = sprintf("d", $res["trackNumber"]);
} else {
//var_dump($file);
}
return $res;
}
require('db.php');
$id=$_REQUEST['id'];
$query = "SELECT * from files where id='".$id."'";
file $url = ' $row['mp3path']'
$mp3data = scanID3($url);
echo 'Album: '.$mp3data['album'].'<br/>';
echo 'Title: '.$mp3data['title'].'<br/>';
echo 'Artist: '.$mp3data['artist'].'<br/>';
echo 'Track number: '.$mp3data['trackNumber'].'<br/>';
?>
I have not tested this ^
include('db.php');
$id=$_REQUEST['id'];
$query = "update files SET views = views+1 where id ='".$id."'";
$update = mysqli_query($con,$query) or die(mysql_error());
$query = "SELECT * from files where id='".$id."'";
$result = mysqli_query($con,$query) or die(mysql_error());
$row = mysqli_fetch_assoc($result);
this is my actual code how can i include above code to this?? please consider me as a noob.
include('db.php');
function scanID3($file)
{
require_once 'libraries/getid3/getid3.php'; //change to getid3 location
$res = false;
$getID3 = new getID3();
$id3 = $getID3->analyze($file);
if (isset($id3["fileformat"]) && $id3["fileformat"] == "mp3") {
$res = array();
$res["file"] = $file;
$res["album"] = $id3["tags"]["id3v2"]["album"][0];
$res["title"] = $id3["tags"]["id3v2"]["title"][0];
if (isset($id3["tags"]["id3v2"]["artist"][0])) {
$res["artist"] = $id3["tags"]["id3v2"]["artist"][0];
} else {
$res["artist"] = "Unknown";
}
$res["trackNumber"] = $id3["tags"]["id3v2"]["track_number"][0];
$res["link"] = str_replace(["_aaID_", "_trackID_"], [md5($res["artist"] . "_" . $res["album"]), $res["trackNumber"]], $this->config["link"]);
if (strpos($res["trackNumber"], "/")) {
$res["trackNumber"] = substr($res["trackNumber"], 0, strpos($res["trackNumber"], "/"));
}
$res["trackNumber"] = sprintf("d", $res["trackNumber"]);
} else {
//var_dump($file);
}
return $res;
}
$id=$_REQUEST['id'];
$query = "update files SET views = views+1 where id ='".$id."'";
$update = mysqli_query($con,$query) or die(mysql_error());
$query = "SELECT * from files where id='".$id."'";
$result = mysqli_query($con,$query) or die(mysql_error());
$row = mysqli_fetch_assoc($result);
$url = $row['mp3path'];
$mp3data = scanID3($url);
echo 'Album: '.$mp3data['album'].'<br/>';
echo 'Title: '.$mp3data['title'].'<br/>';
echo 'Artist: '.$mp3data['artist'].'<br/>';
echo 'Track number: '.$mp3data['trackNumber'].'<br/>';
?>
Something on the lines of:
<?
include('db.php');
function scanID3($file)
{
require_once 'libraries/getid3/getid3.php'; //change to getid3 location
$res = false;
$getID3 = new getID3();
$id3 = $getID3->analyze($file);
if (isset($id3["fileformat"]) && $id3["fileformat"] == "mp3") {
$res = array();
$res["file"] = $file;
$res["album"] = $id3["tags"]["id3v2"]["album"][0];
$res["title"] = $id3["tags"]["id3v2"]["title"][0];
if (isset($id3["tags"]["id3v2"]["artist"][0])) {
$res["artist"] = $id3["tags"]["id3v2"]["artist"][0];
} else {
$res["artist"] = "Unknown";
}
$res["trackNumber"] = $id3["tags"]["id3v2"]["track_number"][0];
$res["link"] = str_replace(["_aaID_", "_trackID_"], [md5($res["artist"] . "_" . $res["album"]), $res["trackNumber"]], $this->config["link"]);
if (strpos($res["trackNumber"], "/")) {
$res["trackNumber"] = substr($res["trackNumber"], 0, strpos($res["trackNumber"], "/"));
}
$res["trackNumber"] = sprintf("d", $res["trackNumber"]);
if(isset($id3['comments']['picture'][0])){
$res['image'] = 'data:'.$id3['comments']['picture'][0]['image_mime'].';charset=utf-8;base64,'.base64_encode($id3['comments']['picture'][0]['data']);
}
else
{
$res['image'] = 'unknown';
}
} else {
//var_dump($file);
}
return $res;
}
$id=$_REQUEST['id'];
$query = "update files SET views = views+1 where id ='".$id."'";
$update = mysqli_query($con,$query) or die(mysql_error());
$query = "SELECT * from files where id='".$id."'";
$result = mysqli_query($con,$query) or die(mysql_error());
$row = mysqli_fetch_assoc($result);
$url = $row['mp3path'];
$mp3data = scanID3($url);
echo 'Album: '.$mp3data['album'].'<br/>';
echo 'Title: '.$mp3data['title'].'<br/>';
echo 'Artist: '.$mp3data['artist'].'<br/>';
echo 'Track number: '.$mp3data['trackNumber'].'<br/>';
if($mp3data['image']!='unknown')
{
echo '<img src="'.$mp3data['image'].'" alt=""/><br/>';
}
?>
Must have been tired:
echo '<img src="'.$mp3data['image'].'" alt=""/><br/>';
This is file.php i need to make the download.php or get.php file to force mp3 file not to stream but to download with update downlod count ($dcount+1) everytime when user hit download button. When download button function as get.php?id=($id) or download.php?id=($id)
is there anyway you can help me to develop this brother?? In this few days i had grabed lots of things from you brother thank you verymuch for that.😊