Alrighty then...
Still having an issue but I think it has something to do with the RecursiveDirectoryIterator...
I get this error:
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(/mp3/) [<a href='function.RecursiveDirectoryIterator---construct'>function.RecursiveDirectoryIterator---construct</a>]: failed to open dir: not implemented' in /home/content/site/html/sites/music/playlist.php:17 Stack trace: #0 /home/content/site/html/sites/music/playlist.php(17): RecursiveDirectoryIterator->__construct('/mp3/') #1 {main} thrown in /home/content/site/html/sites/music/playlist.php on line 17This is what I am using:
<?php
//-----------------------------------------------------------------
// Search for MP3s and their Album Art
// *** requires PHP5 ***
//-----------------------------------------------------------------
// MP3 extension
$mp3 = ".mp3";
// Album Art Filename (Has to be the same in each folder that the MP3s are found.)
$albumart = AlbumArtSmall.jpg;
// Path to the root folder that you want to scan
$directory = "/mp3/";
$it = new RecursiveDirectoryIterator($directory);
foreach(new RecursiveIteratorIterator($it) as $file){
if (!((strpos(strtolower($file), $mp3)) === false)){
$items[] = preg_replace("#\\\#", "/", $file);
$image = $directory.$albumart;
}
}
sort($items);
// header("content-type:text/xml;charset=utf-8");
$filename=fopen('playlist.xspf',"w");
$contents = "<?xml version='1.0' encoding='UTF-8'?>\n
<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n
<title>PHP Generated Playlist</title>\n
<info>http://www.jeroenwijering.com/</info>\n\n
<trackList>\n
foreach($items as $item)
{
$title_array = explode('/', $item);
$title = substr(end($title_array), 0, (strlen(end($title_array)) - 4));
$albumart =
$image = file_exists($albumart)
<track>\n'
<annotation>'.$title.'</annotation>\n
<location>'.$item.'</location>\n
<image>'.$image.'</image>\n
</track>\n';
}
</trackList>\n
</playlist>\n";
fwrite($filename,utf8_encode($contents));
fclose($filename);
echo "< script >window.open('player.htm')< /script >";
?>Again the idea is this script would go through the folders on the server and gather the filename and other information to inject all of the MP3s into this XSPF file to allow an open source media player to dynamically play newer content without actually editing the playlist.
Thank you and God bless,
Johnathan
Hey everyone,
Hope you all had a blessed and safe weekend...
I still can't get this working right.
Here is my code:
<?php
//-----------------------------------------------------------------
// Search for MP3s and their Album Art
// *** requires PHP5 ***
//-----------------------------------------------------------------
// MP3 extension
$mp3 = ".mp3";
// Album Art Filename (Has to be the same in each folder that the MP3s are found.)
$albumart = "AlbumArtSmall.jpg";
// Path to the root folder that you want to scan
$directory = "mp3/";
/*** check if we have a valid directory ***/
if(!is_dir($directory)){
//throw new Exception('Directory does not exist!'."\n");
echo "<font color='red'>The $directory folder does not exist!</font><br />";
}
/*** check if we have permission to rename the files ***/
if( !is_readable( $directory )){
//{throw new Exception('You do not have permissions to read this folder!'."\n");
echo "<font color='red'>You do not have permissions to read the $directory folder!</font><br />";
}
$it = new RecursiveDirectoryIterator(new RecursiveDirectoryIterator($directory));
foreach(new RecursiveIteratorIterator($it) as $file){
if (!((strpos(strtolower($file), $mp3)) === false)){
$items[] = preg_replace("#\\\#", "/", $file);
$image = $directory.$albumart;
}
}
sort($items);
// header("content-type:text/xml;charset=utf-8");
$filename=fopen('playlist.xspf',"w");
$header = "<?xml version='1.0' encoding='UTF-8'?>\n
<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n
<title>PHP Generated Playlist</title>\n
<info>http://www.jeroenwijering.com/</info>\n\n
<trackList>\n";
foreach($items as $item){
$title_array = explode('/', $item);
$title = substr(end($title_array), 0, (strlen(end($title_array)) - 4));
$image = file_exists($albumart);
$tracks = " <track>\n
<annotation>$title</annotation>\n
<location>$item</location>\n
<image>$image</image>\n
</track>\n";
}
$footer = "
</trackList>\n
</playlist>\n";
$contents = $header.$tracks.$footer;
fwrite($filename,utf8_encode($contents));
fclose($filename);
echo "< script >window.open('player.htm')< /script >";
?>The playlist.xspf does it created but it shows this:
<?xml version='1.0' encoding='UTF-8'?> <playlist version='1' xmlns='http://xspf.org/ns/0/'> <title>PHP Generated Playlist</title> <info>http://www.jeroenwijering.com/</info> <trackList> <track> <annotation>the_unit</annotation> <location>./the_unit.mp3</location> <image></image> </track> </trackList> </playlist>
So what is creating that '.' in: ./the_unit.mp3
And why isn't it looking through the "mp3/" folders.
God bless,
Johnathan
Hey everyone,
OK, I've gotten several things corrected.
To include my last post...
Anyway, what is happening now is that the list is created... but only the last file is added to the playlist.
Here is what I have thus far:
<?php
//-----------------------------------------------------------------
// Search for MP3s and their Album Art
// *** requires PHP5 ***
//-----------------------------------------------------------------
// MP3 extension
$mp3 = ".mp3";
// Album Art Filename (Has to be the same in each folder that the MP3s are found.)
$albumart = "AlbumArtSmall.jpg";
// Website URL
$site = "http://DOMAIN.com/";
// Path to the root folder that you want to scan
$directory = "mp3/";
// Check to see if we have a valid directory
if(!is_dir($directory)){
echo "<font color='red'>The $directory folder does not exist!</font><br />";
}
// check to see if we have permission to read the files
if( !is_readable( $directory )){
echo "<font color='red'>You do not have permissions to read the $directory folder!</font><br />";
}
$it = new RecursiveDirectoryIterator($directory); // Was$it = new RecursiveDirectoryIterator(new RecursiveDirectoryIterator($directory));
foreach(new RecursiveIteratorIterator($it) as $file) {
if (!((strpos(strtolower($file), $mp3)) === false)){
$items[] = preg_replace("#\\\#", "/", $file);
$image = $it.$albumart;
}
echo "$items";
}
// sort($items);
$filename=fopen('playlist.xspf',"w");
$header = "<?xml version='1.0' encoding='UTF-8'?>\n
<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n
<title>PHP Generated Playlist</title>\n
<info>http://www.jeroenwijering.com/</info>\n\n
<trackList>\n";
foreach($items as $item){
$title_array = explode('/', $item);
$title = substr(end($title_array), 0, (strlen(end($title_array)) - 4));
$image = file_exists($albumart);
$songlink = str_replace(" ","%20",$site.$item);
$tracks = " <track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$image</image>\n
</track>\n";
}
$footer = "
</trackList>\n
</playlist>\n";
$contents = $header.$tracks.$footer;
fwrite($filename,utf8_encode($contents));
fclose($filename);
echo "< script >window.open('player.htm')< /script >";
?>The above outputs:
<?xml version='1.0' encoding='UTF-8'?> <playlist version='1' xmlns='http://xspf.org/ns/0/'> <title>PHP Generated Playlist</title> <info>http://www.jeroenwijering.com/</info> <trackList> <track> <annotation>14 - Paul Wilbur - Days of Elijah</annotation> <location>mp3/Paul%20Wilbur/Jerusalem%20Arise/14%20-%20Paul%20Wilbur%20-%20Days%20of%20Elijah.mp3</location> <image></image> </track> </trackList> </playlist>
So now it works!
Just need to figure out why it is only writing the last MP3 to the file...
God bless,
Johanthan
Hey hey,
OK, I've fixed the 'gathering of the album image' issue I was having...
Now, why doesn't it create more than one entry...
Current code:
<?php
//-----------------------------------------------------------------
// Search for MP3s and their Album Art
// *** requires PHP5 ***
//-----------------------------------------------------------------
// Album Image Filename (Change to that image file you use. Some use also 'AlbumArtSmall.jpg' as define by WMP.)
$imagename = "AlbumArtSmall.jpg";
// Website URL (Change to the URL to this file folder.)
$site = "http://DOMAIN.com/";
// Path to the root folder that you want to scan (The folder with your MP3s and other media.)
$directory = "mp3/";
// MP3/JPG extension -=Don't Change ANYTHING below this line!=-
$mp3 = ".mp3";
$jpg = ".jpg";
// Check to see if we have a valid directory
if(!is_dir($directory)){
echo "<font color='red'>The $directory folder does not exist!</font><br />";
}
// check to see if we have permission to read the files
if( !is_readable( $directory )){
echo "<font color='red'>You do not have permissions to read the $directory folder!</font><br />";
}
// Gather the filenames of every file within the folder/subfolder of $directory
$files = new RecursiveDirectoryIterator($directory);
// For each file gather information
foreach(new RecursiveIteratorIterator($files) as $file) {
// Gather the MP3 files.
if (!((strpos(strtolower($file), $mp3)) === false)){
$mp3s[] = preg_replace("#\\\#", "/", $file);
}
// echo "$mp3s<br />";
// Gather the image file of each album
if (!((strpos(strtolower($file), $jpg)) === false)){
$jpgs = preg_replace("#\\\#", "/", $file);
// echo "$jpgs<br />";
// Gather the folder only of each image file
$artpath = $site.dirname($jpgs)."\\".$imagename; // Was $folder
// echo "$artpath";
$correct = "/";
$albumart = str_replace("\\", $correct, $artpath);
// echo "$albumart";
// Replace the last "\" with a "/"
// $folderredo = str_replace("#\\\#", "/", $jpgs);
// echo "$folderredo<br />";
// $albumart = $site.$folder.$imagename;
// echo "$albumart";
}
}
// Sort the items found
sort($mp3s);
// Open the new playlist.xspf file to write to it
$filename=fopen('playlist.xspf',"w");
// Header of the XSPF file
$header = "<?xml version='1.0' encoding='UTF-8'?>\n
<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n
<title>PHP Generated Playlist</title>\n
<info>http://www.jeroenwijering.com/</info>\n\n
<trackList>\n";
// Gather each MP3 file and its information
foreach($mp3s as $mp3){
$title_array = explode('/', $mp3);
$title = substr(end($title_array), 0, (strlen(end($title_array)) - 4));
$songlink = str_replace(" ","%20",$site.$mp3);
$artlink = str_replace(" ","%20",$albumart);
$tracks = " <track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$artlink</image>\n
</track>\n";
}
// Footer of the XSPF file
$footer = "
</trackList>\n
</playlist>\n";
// Gather all contents from above
$contents = $header.$tracks.$footer;
// Write the $contents to plsylist.xspf
fwrite($filename,utf8_encode($contents));
// Close the playlist.xspf file
fclose($filename);
// Launch the player with the newly created playlist.xspf file (NOTE: this file is defined in the following HTML file.)
echo "<script>window.open('player.htm')</script>";
?>You're seeing the last track right? Your issue is:
$tracks = "<track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$artlink</image>\n
</track>\n";and it should be
$tracks .= "<track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$artlink</image>\n
</track>\n";Note the period before the equals sign. This way your string is appended to each time. That'll get you every time or at least it has me.
@Bishop Booyah,
Awesome work... yeah that did it for the music... now I've got a 800+ auto playlist that created itself on the fly!
Awesome....
One problem though... the same image file is being used for each song... how can I correct this?
My next step is to move away from the filename as the title and use the tags on each MP3 instead... but I want to get this finished 1st...
God bless,
Johnathan
Make your albumart variable an array like your mp3s array. Or make $mp3s array multidimensional ie $mp3s = array(song -> mp3info, albumart -> artinfo)
For tag info use getid3 (http://getid3.sourceforge.net/) if the id3 tag has albumart in it, you could use that instead of pointing to an external file. Might help out.
I am already working on the getID3 stuff... great minds think alike...
I did make the $jpgs an array, and when they are echoed out, they show up as arrays... just like the $mp3s works.
Yet it doesn't get the albumart right but does the MP3s right.
More code:
// Gather the MP3 files.
if (!((strpos(strtolower($file), $mp3ext)) === false)){
$mp3s[] = preg_replace("#\\\#", "/", $file);
}
// echo "$mp3s<br />";
// Gather the image file of each album
if (!((strpos(strtolower($file), $jpgext)) === false)){
$jpgs[] = preg_replace("#\\\#", "/", $file);
// echo "$jpgs<br />";
$artpath = str_replace("#\\\#", "/", $jpgs);
$albumart = $site.$artpath;You're sorting the mp3 array, are you also sorting the jpg array?
If the indexes are the same (ie $mp3[1] = $jpg[1]) then simply use the index from mp3 to index the jpg.
foreach($mp3s as $index => $mp3){
$title_array = explode('/', $mp3);
$title = substr(end($title_array), 0, (strlen(end($title_array)) - 4));
$songlink = str_replace(" ","%20",$site.$mp3);
$artlink = str_replace(" ","%20",$albumart[$index]);
$tracks = " <track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$artlink</image>\n
</track>\n";
}Well, that was interesting... I did as you suggested... and it took each character of a link to an image and placed that single character in each of the variables:
<image>h</image> <image>t</image> <image>t</image> <image>p</image> <image>:</image> <image>/</image> <image>/</image> <image>m</image> <image>u</image> <image>s</image> <image>i</image> <image>c/image> <image>.</image> <image>a</image> <image>g</image> ...
Any other ideas?
Yeah, your $albumart needs to be an array or just use the $jpgs
Maybe:
if (!((strpos(strtolower($file), $jpgext)) === false)){
$jpgs[] = $site.str_replace("#\\\#", "/", preg_replace("#\\\#", "/", $file));
}
...
foreach($mp3s as $index => $mp3){
$title_array = explode('/', $mp3);
$title = substr(end($title_array), 0, (strlen(end($title_array)) - 4));
$songlink = str_replace(" ","%20",$site.$mp3);
$artlink = str_replace(" ","%20",$jpgs[$index]);
$tracks = " <track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$artlink</image>\n
</track>\n";
}OK so I am using the following:
// For each file gather information
foreach(new RecursiveIteratorIterator($files) as $file) {
// Gather the MP3 files.
if (!((strpos(strtolower($file), $mp3ext)) === false)){
$mp3s[] = preg_replace("#\\\#", "/", $file);
}
// echo "$mp3s<br />";
// Gather the image file of each album
if (!((strpos(strtolower($file), $jpgext)) === false)){
$jpgs[] = preg_replace("#\\\#", "/", $file);
// echo "$jpgs<br />";
// Include the Album Art Configuration file
include("config/albumartconfig.php");
}
}
// Sort the items found
sort($mp3s);
sort($jpgs);
foreach($mp3s as $index => $mp3){ // Was foreach($mp3s as $mp3){
include("config/titleconfig.php");
$songlink = str_replace(" ","%20",$site.$mp3);
foreach($jpgs as $jpg){
$artlink = str_replace(" ","%20",$site.$jpgs[$index]); // Was $artlink = str_replace(" ","%20",$albumart);
}
$tracks .= " <track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$artlink</image>\n
</track>\n";
}OK, the images are working... but because there are less images and more MP3, the 4 images available link to the 1st four MP3s, then the next 4 images, from the next album, link to the next four MP3s... in the previous album.
So how can we link the image in the same folder to each MP3 in that folder?
Can we not use what I have here?
Seriously, you'd save yourself a lot of problems just by getting the albumart via getid3.
You can make the $mp3s a multidimensional array(directory, mp3file => mp3, artwork => jpg)
foreach(new RecursiveDirectoryIterator($directory) as $dir){
$path = RecursiveDirectoryIterator::key;
// For each file gather information
foreach(new RecursiveIteratorIterator($dir) as $file) {
// Gather the MP3 files.
if (!((strpos(strtolower($file), $mp3ext)) === false))
$mp3s[] = preg_replace("#\\\#", "/", $file);
// Gather the image file of each album
if (!((strpos(strtolower($file), $jpgext)) === false))
$artwork = preg_replace("#\\\#", "/", $file);
}
$albumfolders[$path][mp3s] = $mp3s;
$albumfolders[$path][artwork] = $artwork;
}
// Sort the albums by directory
asort($albumfolders);
foreach($albumfolders as $album) {
// sort the individual album mp3s
asort($album[mp3s]);
$artwork = $album[artwork];
foreach ($album[mp3s] as $mp3){
include("config/titleconfig.php");
$songlink = str_replace(" ","%20",$site.$mp3);
$artlink = str_replace(" ","%20",$site.$artwork);
$tracks .= "<track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$artlink</image>\n
</track>\n";
}
}Try that, I doubt if it will work since I didn't run it. I'm just shooting in the dark but it should help give you a direction. Print out the variables as you go along and that'll help you traverse the array of arrays.
GetID3() was my next step... I'd rather use that...
The link to that would be:
http://www.tsgcomputers.net/getID3/getid3.php
Can you rewrite that with the link...
I did try to use the getID3... and I get this error:
Fatal error: Class 'getID3' not found at line 15
Here is line 15 in which it is complaining about:
$getID3 = new getID3;
Here is the whole code (I took out the bunch of comments I had.):
<?php
// Tried using an include however to be able to use this for any site, the following is needed:
//include("http://www.tsgcomputers.net/getid3/getid3.php");
$getid3php = file_get_contents("http://www.tsgcomputers.net/getid3/getid3.php");
echo $getid3php;
$getID3 = new getID3;
$analyzefiles = $getID3->analyze($files);
getid3_lib::CopyTagsToComments($analyzefiles);
$artist = @$analyzefiles['comments_html']['artist'][0]; // artist from any/all available tag formats
$song = @$analyzefiles['tags']['id3v2']['title'][0]; // title from ID3v2
$title = $artist.$song;
?>Why not use the sourceforge library? http://getid3.sourceforge.net
They've got a ton of examples.
Just download the latest stable package 1.7.7, unzip it into your working directory and then you can run one of the many demos included in the package.
One of the simple demos will scan a directory for you: http://getid3.sourceforge.net/source/demo.simple.phps
There are a lot of different demos so you should be able to find one that almost does what you want and then modify it. Getid3 is nice because you can even append audio to an mp3 clip. Pretty cool.
Hey everyone,
I actually figured it out...
Have you ever had a problem that has been plaquing you for days.. then you get a good night's rest and wake up with the solution?
Like an epiphany or a lightbulb moment?
Exactly what happened...
And it was so easy too...
OK, so I already had an array setup for the mp3s... and I was trying to use another array for the jpgs... that was my problem...
The solution... I used the mp3 array I already had and added that variable for the image to use in that same function and... voila!
Problem solved...
Now how to get getID3 to get the artist and song names...
@Booyah,
I did see a lot of examples... but the problem I found was that it wasn't explained how you can input those into your code to gather that info....
All I need is the artist and the song title...
God bless,
Johnathan
Just find an example that does what you want and grab the body of the code (inside the head & body tags) and insert it into your script wherever it fits.
The only thing you'll really have to do is change the path to the id3 library. For example from the demo.basic.phps:
require_once('the/directory/where/you/unzipped/getid3/getid3.php);
// Initialize getID3 engine
$getID3 = new getID3;
// Inside your foreach where you print out each mp3 do this
foreach($mp3s as $index => $mp3){
// ... your code ...
// Analyze file and store returned data in $ThisFileInfo
$ThisFileInfo = $getID3->analyze($mp3);
// Output desired information in whatever format you want
echo @$ThisFileInfo['comments_html']['artist'][0]; // artist from any/all available tag formats
echo @$ThisFileInfo['tags']['id3v2']['title'][0]; // title from ID3v2
echo @$ThisFileInfo['audio']['bitrate']; // audio bitrate
echo @$ThisFileInfo['playtime_string']; // playtime in minutes:seconds, formatted string
// ... print out your track xml ...I did go ahead and worked a little on it and this is what I have:
include('/home/content/html/getid3/getid3.php');
$getID3 = new getID3;
$analyzefiles = $getID3->analyze($files);
getid3_lib::CopyTagsToComments($analyzefiles);
$artist = @$analyzefiles['comments_html']['artist'][0];
$song = @$analyzefiles['tags']['id3v2']['title'][0];
$title = $artist.$song;I get this error when I try to execute that...
Fatal error: Cannot redeclare class getID3 in /home/content/html/getid3/getid3.php on line 19
Any ideas?
God bless,
Johnathan
OK, here is the contents of the titleid3.php file:
<?php
//-----------------------------------------------------------------
// Gather the ID3 tag information
//-----------------------------------------------------------------
include_once('/home/content/html/getid3/getid3.php');
$getID3 = new getID3;
$analyzefiles = $getID3->analyze($mp3);
getid3_lib::CopyTagsToComments($analyzefiles);
$artist = @$analyzefiles['comments_html']['artist'][0]; // artist from any/all available tag formats
$song = @$analyzefiles['tags']['id3v2']['title'][0]; // title from ID3v2
$title = $artist.$song;
?>The path is correct.
Here is the section that includes the above file in the Playlist.php file:
// Gather each MP3 file and its information
foreach($mp3s as $mp3){
// Include the Album Art Configuration file
include("config/albumartconfig.php");
// Include the Song Title Configuration file
include("config/titleconfig.php");
$songlink = str_replace(" ","%20",$site.$mp3);
$tracks .= " <track>\n
<annotation>$title</annotation>\n
<location>$songlink</location>\n
<image>$artlink</image>\n
</track>\n";
}The albumart is working correctly. it is just the title I can't seem to get.
God bless,
Johnathan
Remove
include_once('/home/content/html/getid3/getid3.php');
$getID3 = new getID3;From your titleid3 script and put them outside of the loop. You only need to declare the class once.
You can also put a
print "<pre>";
print_r($analyzefiles);
print "</pre>";To see what getid3 is reading. But I would set your loop to break after one file so you don't get a screen full of stuff. Just insert "break;" at the end of your loop.
Are you sure the id3 tags have information in them?
OK I understand now....
Although I've been told about this library before only needing to be loaded once... I hadn't thought about removing it from the loop.
The ID tags are loading correctly.... some of the songs aren't right but that is another matter for me to fix.
Thank you so much... it is working now.
Sorry for all the trouble... the getID3() looks more confusing than it really is. And finding the right information to use it correctly took some looking into... figured it would be easier than going through a forum...
God bless,
Johnathan
a) Why would you need this? and b) How important is this?
It can be done, but is this for a sermon series or just a music playlist or what?
This is more complicated, but you would basically need a two dimensional array (file=> $file, date => $filemodifieddate), then sort it on the date.
If this is for a sermon series, then I'd just suggest using the date as part of the file name since it's easier to sort on the file name than the date.
But if it's important you should probably post your code and I'll try to help you out.
Hey everyone,
OK so as the topic suggests... I am working on automatically creating an XSPF playlist for an open source player.
This is what I have thus far:
index.htm
playlist.php
<?php //----------------------------------------------------------------- // Search for MP3s and their Album Art // *** requires PHP5 *** //----------------------------------------------------------------- // MP3 extension $mp3 = ".mp3"; // Album Art Filename (Has to be the same in each folder that the MP3s are found.) $albumart = AlbumArtSmall.jpg; // Path to the root folder that you want to scan $directory = "/mp3"; $it = new RecursiveDirectoryIterator( new RecursiveDirectoryIterator($directory)); foreach(new RecursiveIteratorIterator($it) as $file){ if (!((strpos(strtolower($file), $mp3)) === false)){ $items[] = preg_replace("#\\\#", "/", $file); $image = $directory.$albumart; } } sort($items); // header("content-type:text/xml;charset=utf-8"); $filename=fopen('playlist.xspf',"w"); $contents = "<?xml version='1.0' encoding='UTF-8'?>\n <playlist version='1' xmlns='http://xspf.org/ns/0/'>\n <title>PHP Generated Playlist</title>\n <info>http://www.jeroenwijering.com/</info>\n\n <trackList>\n foreach($items as $item) { $title_array = explode('/', $item); $title = substr(end($title_array), 0, (strlen(end($title_array)) - 4)); $albumart = $image = file_exists($albumart) <track>\n' <annotation>'.$title.'</annotation>\n <location>'.$item.'</location>\n <image>'.$image.'</image>\n </track>\n'; } </trackList>\n </playlist>\n"; fwrite($filename,utf8_encode($contents)); fclose($filename); echo "< script >window.open('player.htm')< /script >"; ?>player.htm
So when I click on the 'Create Playlist' button I get the following error:
Fatal error: Cannot instantiate non-existent class: recursivedirectoryiterator in 'playlist.php' line 18
What am I doing wrong?
Thank you and God bless,
Johnathan