Advanced nowplaying forum signature

Third-party modifications and add-ons, Apps and Clients

Moderator: moderators

Re: Advanced nowplaying forum signature

Postby Hellscream » Thu Feb 23, 2012 10:51 pm

On google chrome i just have little box with 3 colored circles
On IE i get this errors
Code: Select all
<br />
<b>Warning</b>:  imagecreatefrompng(c:
mpp\htdocs\subsig\back3.png) [<a href='function.imagecreatefrompng'>function.imagecreatefrompng</a>]: failed to open stream: Invalid argument in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>29</b><br />
<br />
<b>Warning</b>:  imagecolorallocate() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>30</b><br />
<br />
<b>Warning</b>:  imagettftext() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>37</b><br />
<br />
<b>Warning</b>:  imagecolorallocate() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>:  imagettftext() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>:  imagepng() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>43</b><br />
<br />
<b>Warning</b>:  imagedestroy() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>44</b><br />
Image
User avatar
Hellscream
 
Posts: 160
Joined: Fri Apr 22, 2011 11:47 am
Location: Serbia

Re: Advanced nowplaying forum signature

Postby SparkyRih » Thu Feb 23, 2012 10:58 pm

You have my register engine running right? the captcha does work correctly right?
VMWare ESXi 5.5 > Ubuntu 16.04 > Subsonic 6.0 (Modded with PHP based registration feature)

Image
User avatar
SparkyRih
 
Posts: 216
Joined: Wed May 11, 2011 1:52 pm
Location: The Netherlands

Re: Advanced nowplaying forum signature

Postby Hellscream » Thu Feb 23, 2012 10:59 pm

Yes everything is working with regengine
Image
User avatar
Hellscream
 
Posts: 160
Joined: Fri Apr 22, 2011 11:47 am
Location: Serbia

Re: Advanced nowplaying forum signature

Postby SparkyRih » Thu Feb 23, 2012 11:05 pm

Could you replace line 29 with this?

Code: Select all
$image = imagecreatefrompng("back3.png");


Test it while you are not playing anything...
VMWare ESXi 5.5 > Ubuntu 16.04 > Subsonic 6.0 (Modded with PHP based registration feature)

Image
User avatar
SparkyRih
 
Posts: 216
Joined: Wed May 11, 2011 1:52 pm
Location: The Netherlands

Re: Advanced nowplaying forum signature

Postby Hellscream » Thu Feb 23, 2012 11:07 pm

k give me sec
Same thing no change at all
Image
User avatar
Hellscream
 
Posts: 160
Joined: Fri Apr 22, 2011 11:47 am
Location: Serbia

Re: Advanced nowplaying forum signature

Postby SparkyRih » Thu Feb 23, 2012 11:09 pm

Hellscream wrote:k give me sec
Same thing no change at all


It should at least come back with a different error??
VMWare ESXi 5.5 > Ubuntu 16.04 > Subsonic 6.0 (Modded with PHP based registration feature)

Image
User avatar
SparkyRih
 
Posts: 216
Joined: Wed May 11, 2011 1:52 pm
Location: The Netherlands

Re: Advanced nowplaying forum signature

Postby Hellscream » Thu Feb 23, 2012 11:11 pm

SparkyRih wrote:
Hellscream wrote:k give me sec
Same thing no change at all


It should at least come back with a different error??

Code: Select all
<br />
<b>Warning</b>:  imagecreatefrompng(c:
mpp\htdocs\subsig\back.png) [<a href='function.imagecreatefrompng'>function.imagecreatefrompng</a>]: failed to open stream: Invalid argument in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>49</b><br />
<br />
<b>Warning</b>:  imagecreatefromstring() [<a href='function.imagecreatefromstring'>function.imagecreatefromstring</a>]: Empty string or invalid image in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>59</b><br />
<br />
<b>Warning</b>:  imagecolorallocate() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>61</b><br />
<br />
<b>Warning</b>:  imagettftext() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>68</b><br />
<br />
<b>Warning</b>:  imagecolorallocate() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  imagettftext() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>69</b><br />
<br />
<b>Warning</b>:  imagecopy() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>71</b><br />
<br />
<b>Warning</b>:  imagepng() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>76</b><br />
<br />
<b>Warning</b>:  imagedestroy() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\subsig\signature.php</b> on line <b>77</b><br />
Image
User avatar
Hellscream
 
Posts: 160
Joined: Fri Apr 22, 2011 11:47 am
Location: Serbia

Re: Advanced nowplaying forum signature

Postby SparkyRih » Thu Feb 23, 2012 11:15 pm

You see.. line 29 is fine now, but it goes to 49 (which still has the same issue)... let me fix the full code, just a moment...
VMWare ESXi 5.5 > Ubuntu 16.04 > Subsonic 6.0 (Modded with PHP based registration feature)

Image
User avatar
SparkyRih
 
Posts: 216
Joined: Wed May 11, 2011 1:52 pm
Location: The Netherlands

Re: Advanced nowplaying forum signature

Postby Hellscream » Thu Feb 23, 2012 11:16 pm

SparkyRih wrote:You see.. line 29 is fine now, but it goes to 49 (which still has the same issue)... let me fix the full code, just a moment...

OK m8 I appreciate your help
Image
User avatar
Hellscream
 
Posts: 160
Joined: Fri Apr 22, 2011 11:47 am
Location: Serbia

Re: Advanced nowplaying forum signature

Postby SparkyRih » Thu Feb 23, 2012 11:21 pm

Should be fine now, I hope I didn't skip any line :S
VMWare ESXi 5.5 > Ubuntu 16.04 > Subsonic 6.0 (Modded with PHP based registration feature)

Image
User avatar
SparkyRih
 
Posts: 216
Joined: Wed May 11, 2011 1:52 pm
Location: The Netherlands

Re: Advanced nowplaying forum signature

Postby Hellscream » Thu Feb 23, 2012 11:21 pm

SparkyRih wrote:Should be fine now, I hope I didn't skip any line :S

Downloading :P
What can i say m8 TY VERY much everything is fine.
Keep with awesome work you little genie :D
Image
User avatar
Hellscream
 
Posts: 160
Joined: Fri Apr 22, 2011 11:47 am
Location: Serbia

Re: Advanced nowplaying forum signature

Postby SparkyRih » Thu Feb 23, 2012 11:34 pm

You are running Apache 2.2.21 on Windows, I'm running the same version of Apache on Ubuntu... why does Windows read the code in a different way? :S

But I"m looking forward to your subsig design :)
VMWare ESXi 5.5 > Ubuntu 16.04 > Subsonic 6.0 (Modded with PHP based registration feature)

Image
User avatar
SparkyRih
 
Posts: 216
Joined: Wed May 11, 2011 1:52 pm
Location: The Netherlands

Re: Advanced nowplaying forum signature

Postby Hellscream » Thu Feb 23, 2012 11:38 pm

I have no idea but im happy now thx to you :D.
Installing Photo Shop atm :P
Image
User avatar
Hellscream
 
Posts: 160
Joined: Fri Apr 22, 2011 11:47 am
Location: Serbia

Re: Advanced nowplaying forum signature

Postby gurutech » Sat May 05, 2012 7:44 pm

Just installed this a while ago (earlier today), and I can't get the "text" part of the image working, or the cover art. I just have a "stock" image, no matter if I am listening to something or not.

Code: Select all
<?php
//First collect some data:
$user = "test"; //user to monitor
$admin = "admin"; //user to get nowPlaying list
$adminpass = "(password)"; //pass to get nowPlaying list (plain or using enc:)
$server = "servername"; //Your subsonic server
$xml = @simplexml_load_file("http://".$server."/rest/getNowPlaying.view?u=".$admin."&p=".$adminpass."&v=1.5.0&c=signature");

if($xml==false) {

   goto offline;
   }

//Timestamp
$time = "My local time: ".date("H:i");

//If the server is online, check what the monitored user is listening or watching, and jump to the right code...
foreach($xml->children()->children() as $second_gen) {
$math = floor($second_gen['duration']/60);

if($second_gen['username']==$user and $second_gen['minutesAgo']<=$math) {

   if($second_gen['isVideo']=='false') {
   
   goto playing;
   }

      else{
   
      goto watching;
      }

   }
}

//If user is offline, or the last file has finished playing...
nothing:
$image = imagecreatefrompng("back2.png");
$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."/VeraBd.ttf";
$fontSize = 16;
$fontRotation = 0;
$x = 1;  //160
$y = 1;    //65
$str = "Not listening to any music\nor watching any video now...";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
imagettftext($image, 12, 0, 1, 1, imagecolorallocate($image, 230, 49, 150), getcwd()."/scriptbl.ttf", $time);
//imagettftext($image, 12, 0, 65, 295, imagecolorallocate($image, 230, 49, 150), getcwd()."/scriptbl.ttf", $time);
header("Content-type: image/png"); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Fri, 19 Jan 1994 05:00:00 GMT"); 
header("Pragma: no-cache"); 
imagepng($image);
imagedestroy($image);
exit();

//If the user is playing a music file...
playing:
$image = imagecreatefrompng("back2.png");
//Get the cover art
$coverart = "http://".$server."/rest/getCoverArt.view?u=".$admin."&p=".$adminpass."&v=1.5.0&c=signature&id=".$second_gen['coverArt']."&size=100";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $coverart);
curl_setopt ($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_HEADER, false);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
$rawdata = curl_exec($ch);
$image2 = imagecreatefromstring($rawdata);
curl_close($ch);
$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."/VeraBd.ttf";
$fontSize = 12;
$fontRotation = 0;
$x = 510;
$y = 100;
$str = "Now Playing\nArtist: ".$second_gen['artist']."\nTitle: ".$second_gen['title']."\nAlbum: ".$second_gen['album'];
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
imagettftext($image, 12, 0, 1, 1, imagecolorallocate($image, 230, 49, 150), getcwd()."/scriptbl.ttf", $time);
//imagettftext($image, 12, 0, 65, 295, imagecolorallocate($image, 230, 49, 150), getcwd()."/scriptbl.ttf", $time);

//Cover art location
imagecopy($image, $image2, 430, 170, 0, 0, 100, 100);
header("Content-type: image/png"); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Fri, 19 Jan 1994 05:00:00 GMT"); 
header("Pragma: no-cache"); 
imagepng($image);
imagedestroy($image);
exit();

//If the user is playing a video file...
watching:
$image = imagecreatefrompng("back2.png");
$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."/VeraBd.ttf";
$fontSize = 12;
$fontRotation = 0;
$x = 170;
$y = 55;
$str = "Now Watching\n".$second_gen['title'];
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
imagettftext($image, 12, 0, 65, 295, imagecolorallocate($image, 230, 49, 150), getcwd()."/scriptbl.ttf", $time);
header("Content-type: image/png"); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Fri, 19 Jan 1994 05:00:00 GMT"); 
header("Pragma: no-cache"); 
imagepng($image);
imagedestroy($image);
exit();

//If the server is offline (404)...
offline:
$image = imagecreatefrompng("back2.png");
$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."VeraBd.ttf";
$fontSize = 16;
$fontRotation = -7;
$x = 160;
$y = 65;
$str = "My server seems to be down\nI'll get it back up as soon\nas possible...";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
imagettftext($image, 12, 0, 65, 295, imagecolorallocate($image, 230, 49, 150), getcwd()."scriptbl.ttf", $time);
header("Content-type: image/png"); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Fri, 19 Jan 1994 05:00:00 GMT"); 
header("Pragma: no-cache"); 
imagepng($image);
imagedestroy($image);exit();
exit();
?>


As you can see, I did some minor mods to the code (probably did it wrong), trying to get the image size to be a certain size, before just editing the image itself. (This didn't get the text to show either).

Not sure if this is possible with the current code, or if some minor code changes could be done to allow multiple users to use a signature file (on the same Subsonic server.)

My idea is that for each user I have on my Subsonic, each user can have their own specific signature file, such as "{username}.png" or something, so they can point their sig file to http://website.subsonic.org/signatures/(their username).png (I'm guessing if I were to specify "{username}.png" in the code, instead of "back2.png", it would work, but how would I get the first line of code "$user" to be the actual user name?

Can this be done? What coding changes should I make to allow this?

Thanks!
Image
gurutech
 
Posts: 492
Joined: Sun Jan 15, 2012 9:56 pm

Re: Advanced nowplaying forum signature

Postby SparkyRih » Mon May 07, 2012 1:42 pm

First try my image without editing it, if it still doesn't show any text than check if you have the GD module installed.

For user specific signatures, just change $user = "username"
Than rename the php file to: username.php.
Than, for every user, copy the line in it, and replace signature.php and signature.png to the correct usernames.

I hope this is a little bit clear to you, if not, please tell me and I will give some code examples...
VMWare ESXi 5.5 > Ubuntu 16.04 > Subsonic 6.0 (Modded with PHP based registration feature)

Image
User avatar
SparkyRih
 
Posts: 216
Joined: Wed May 11, 2011 1:52 pm
Location: The Netherlands

PreviousNext

Return to Mods, Apps and Clients

Who is online

Users browsing this forum: No registered users and 4 guests