need some help for getid3 plss.

Started on the old forum in November 2020 · view the original in the archive · old links redirect here

12 replies · 117 views · started 6 years ago · 1 min read

2 participants
ayesham Developer · 69 posts #1

Need to show relevant mp3 files tag details on file download page using getid3 script please need your help.

my download code is as follows

require('db.php');
$id=$_REQUEST['id'];
$query = "SELECT * from files where id='".$id."'"; 

file $url = ' $row['mp3path']'

something else Fellow · 2,296 posts #2

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 ^

ayesham Developer · 69 posts #3

file $url = ' $row['mp3path']' here there is a syntax error bro

ayesham Developer · 69 posts #4
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.

something else Fellow · 2,296 posts #6
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/>';
?>
ayesham Developer · 69 posts #7

Is there anyway to show mp3 cover photo ??

something else Fellow · 2,296 posts #8

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/>';
}
?>
ayesham Developer · 69 posts #9

echo '<img src="'.if($mp3data['image'].'" alt=""/> '; syntax error bro

ayesham Developer · 69 posts #11

when running error.php?page=file3.php it shows blank sometime my hosting is not vps. is that can be a reason for this??

something else Fellow · 2,296 posts #12

Must have been tired:

echo '<img src="'.$mp3data['image'].'" alt=""/><br/>';
ayesham Developer · 69 posts #15

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.😊

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close