• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

Now Playing (Album_Image)

Started by nicolasgomez, May 06, 2020, 12:01:33 AM

nicolasgomez

Hello everyone !!, how can I configure my php to display the "album_image" of the artist that is playing ?. I await your responses. :cool: :cool:, Currently in my "now_playing" only presents the "artist" and the "title".

EmmaS

Quote from: nicolasgomez on May 06, 2020, 12:01:33 AM
Hello everyone !!, how can I configure my php to display the "album_image" of the artist that is playing ?. I await your responses. :cool: :cool:, Currently in my "now_playing" only presents the "artist" and the "title".

It'd help if you could display some code for us to look at to help see where you need to configure it...

Personally I use artist name to retrieve images
https://www.xperiencerewind.co.uk/
XperienceRewind.co.uk - 70s and 80s None Stop
https://www.xperiencerewind.co.uk/

XperienceRadio.co.uk - Club Dance & Trance
https://www.xperienceradio.co.uk/

nicolasgomez


function db_conn() {
    global $opened_db, $mysqli_server, $mysqli_user, $mysqli_pass, $mysqli_database, $mysqli_port;

    @$opened_db = mysqli_connect($mysqli_server, $mysqli_user, $mysqli_pass);
   
    if (!$opened_db) {
echo "<p><strong>The database connection cannot be established! Please check if the login details are correct!</strong></p></div>";
        die(mysqli_error());

       
    } else {
        @mysqli_select_db($opened_db, $mysqli_database)
            or die(mysqli_error());
    }
}
   
function db_close($opened_db) {
    @mysqli_close($opened_db);
}

function convertTime($seconds) {
$H = floor($seconds / 3600);
$i = ($seconds / 60) % 60;
$s = $seconds % 60;
   return sprintf("%02d:%02d:%02d", $H, $i, $s);
}

?>
<table class="main_table" border="0" cellspacing="0" cellpadding="5">

<?php

db_conn
();
$shuffleQuery null;

If (
$shufleUpcoming == True) {
    
$shuffleQuery " ORDER BY RAND()";
}


$query "SELECT `ID`, `date_played`, `artist`, `title` FROM `history` WHERE `song_type` = 0 ORDER BY `date_played` DESC LIMIT 0," . ($resLimit+1);

$result mysqli_query($opened_db$query);

if (!
$result) {
    echo 
mysqli_error();
    exit;
}

if (
mysqli_num_rows($result) == 0) {
    exit;
}

$inc 0;

while(
$row mysqli_fetch_assoc($result)) {
    if (
$inc == 0) {
        echo 
" <tr>" "\n";
        echo 
"   <td class=\"header_live\">NOW PLAYING</td>\n";
        echo 
" </tr>" "\n";

        echo 
" <tr>" "\n";
        echo 
"  <td class=\"playing_track\"><strong>" htmlspecialchars($row['artist'], ENT_QUOTES) . " - " htmlspecialchars($row['title'], ENT_QUOTES) ."</strong></td>\n";
        echo 
" </tr>" "\n";

        if (
$resLimit 0) {
            echo 
" <tr>" "\n";
            echo 
"  <td class=\"header_live\">RECENTLY PLAYED SONGS</td>\n";
            echo 
" </tr>" "\n";
        }

    } else {

        if (
$resLimit 0) {
            echo 
" <tr>" "\n";
            echo 
"  <td>" date('H:i'strtotime($row['date_played'])) . "  " htmlspecialchars($row['artist'], ENT_QUOTES) . " - " htmlspecialchars($row['title'], ENT_QUOTES) . "</td>\n";
            echo 
" </tr>" "\n";
        }
    }
    
$inc += 1;
}

@
mysqli_free_result($opened_db$result);
db_close($opened_db);

?>

</table>
<br />
</div>


Quote from: EmmaS on May 06, 2020, 12:03:56 AM
It'd help if you could display some code for us to look at to help see where you need to configure it...

Personally I use artist name to retrieve images
https://www.xperiencerewind.co.uk/

Jhonny

Where are your album_image (folder name)?
R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs ( ͡° ͜ʖ ͡°)
The Radiodj tutorials site is now managed by Domstadradio .nl still  Just in English

nicolasgomez

Quote from: Jhonny on May 06, 2020, 10:27:22 AM
Where are your album_image (folder name)?

The folder address is: "C:\RadioDJv2\Album-Art"
The code takes the song information from a table called "history", but where the song images are stored is in another table called "songs", in the column called "image". These 2 tables are obviously in the same database.

Jhonny

Best to make a folder on the server Album-Art and copy all the art from C:\RadioDJv2\Album-Art in to that folder.
R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs ( ͡° ͜ʖ ͡°)
The Radiodj tutorials site is now managed by Domstadradio .nl still  Just in English

nicolasgomez

#6
Quote from: Jhonny on May 06, 2020, 09:43:46 PM
Best to make a folder on the server Album-Art and copy all the art from C:\RadioDJv2\Album-Art in to that folder.

Copy the entire Album-Art folder to my server, but I don't know how to enter it in my php.  :-[.
would you have an idea?

nicolasgomez

Quote from: EmmaS on May 06, 2020, 12:03:56 AM
It'd help if you could display some code for us to look at to help see where you need to configure it...

Personally I use artist name to retrieve images
https://www.xperiencerewind.co.uk/

How would this code be? Might you help me? I can't find a solution..

EmmaS

Quote from: nicolasgomez on May 07, 2020, 03:18:05 AM
How would this code be? Might you help me? I can't find a solution..

have your pictures in the Album-art folder... this will retrieve images by the name of the artist where the artist name is the name of the jpg eg:
Now playing: abba

abba.jpg = Album-art/abba.jpg


while($row = mysqli_fetch_assoc($result)) {
$artist = htmlspecialchars($row['artist'], ENT_QUOTES);
$title = htmlspecialchars($row['title'], ENT_QUOTES);
$timepl = date('H:i', strtotime($row['date_played']));

    if ($inc == 0) {

echo '<tr><td></td><td class="header_live">NOW PLAYING</td><td></td></tr>';

echo '<tr><td><img src="Album-art/'.$artist.'.jpg" width="120" height="120"></td><td class="playing_track"><h3>'.$artist.'</h3>'.$title.'</td><td></td></tr>';

        if ($resLimit > 0) {
            echo '<tr><td></td><td class="header_live">RECENTLY PLAYED SONGS</td><td></td></tr>';
        }

    } else {

        if ($resLimit > 0) {
            echo '<tr><td><img src="Album-art/'.$artist.'.jpg" width="70" height="70"></td><td><strong>'.$artist.' - '.$title.'</strong></td><td>'.$timepl.'</td></tr>';
        }
    }
    $inc += 1;
}
XperienceRewind.co.uk - 70s and 80s None Stop
https://www.xperiencerewind.co.uk/

XperienceRadio.co.uk - Club Dance & Trance
https://www.xperienceradio.co.uk/

nicolasgomez

Quote from: EmmaS on May 07, 2020, 10:11:26 AM
have your pictures in the Album-art folder... this will retrieve images by the name of the artist where the artist name is the name of the jpg eg:
Now playing: abba

abba.jpg = Album-art/abba.jpg


while($row = mysqli_fetch_assoc($result)) {
$artist = htmlspecialchars($row['artist'], ENT_QUOTES);
$title = htmlspecialchars($row['title'], ENT_QUOTES);
$timepl = date('H:i', strtotime($row['date_played']));

    if ($inc == 0) {

echo '<tr><td></td><td class="header_live">NOW PLAYING</td><td></td></tr>';

echo '<tr><td><img src="Album-art/'.$artist.'.jpg" width="120" height="120"></td><td class="playing_track"><h3>'.$artist.'</h3>'.$title.'</td><td></td></tr>';

        if ($resLimit > 0) {
            echo '<tr><td></td><td class="header_live">RECENTLY PLAYED SONGS</td><td></td></tr>';
        }

    } else {

        if ($resLimit > 0) {
            echo '<tr><td><img src="Album-art/'.$artist.'.jpg" width="70" height="70"></td><td><strong>'.$artist.' - '.$title.'</strong></td><td>'.$timepl.'</td></tr>';
        }
    }
    $inc += 1;
}


Currently the code you passed me is working, it was what I was looking for, Thank you very much !!!
  :ok: :ok: :ok: