Forum sig

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

Moderator: moderators

Re: Forum sig

Postby dazbobaby » Sat May 12, 2012 1:12 pm

website logo and tag line is working. Now for the album/artist/trakc details.
It's really a cheat, but until I can figure out how gaussian blur works, it'll have to do.
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby dazbobaby » Sat May 12, 2012 1:25 pm

It's done, it looks very neat on a light background, and it is a cheat. I duplicated the text layers, created a new sequence with dark text (shadow) then just continued on from there.
Code: Select all
    //If the user is playing a music file...
playing:
$imageList = array("music1.png","music2.png","music10.png","sony1.png","sony4.png","sony13.png");
$image = imagecreatefrompng($imageList[rand(1,count($imageList))-1]);
$end = imagealphablending($image, false);
$save = imagesavealpha($image, true);
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"); 
     //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=150";
$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);
//text colour
// this part is to create the drop shadow
$color = imagecolorallocate($image, 30, 30, 30);
$font = getcwd()."/aliee13.ttf";
$fontSize = 10;
$fontRotation = -0;
$x = 156;
$y = 98;
$end = imagealphablending($image, true);
$str = "Head Bangin' while listening to\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, 152, 282, imagecolorallocate($image, 30, 30, 30), getcwd()."/aliee13.ttf", $time);
$strwww = "www.Mess-Hall.co.uk";
imagettftext($image, 14, 0, 154, 16, imagecolorallocate($image, 30, 30, 30), getcwd()."/Capture it.ttf", $strwww);
$strtag = "A Small Review of Almost Everything";
imagettftext($image, 9, 0, 158, 26, imagecolorallocate($image, 30, 30, 30), getcwd()."/Capture it.ttf", $strtag);
// End of drop shadow

//text colour

$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."/aliee13.ttf";
$fontSize = 10;
$fontRotation = -0;
$x = 155;
$y = 97;
// $image = imagealphablending($str, true);
$end = imagealphablending($image, true);
$str = "Head Bangin' while listening to\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, 150, 280, imagecolorallocate($image, 255, 255, 255), getcwd()."/aliee13.ttf", $time);
$strwww = "www.Mess-Hall.co.uk";
imagettftext($image, 14, 0, 152, 15, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $strwww);
$strtag = "A Small Review of Almost Everything";
imagettftext($image, 9, 0, 156, 25, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $strtag);
// End of drop shadow test
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby SparkyRih » Sat May 12, 2012 1:36 pm

Nice work...
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: Forum sig

Postby dazbobaby » Sat May 12, 2012 3:09 pm

thanks Sparky :) I don't think it would have worked without out the alpha. Thanks for that.

got any samples of your updates in action?
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby SparkyRih » Sat May 12, 2012 3:30 pm

dazbobaby wrote:thanks Sparky :) I don't think it would have worked without out the alpha. Thanks for that.

got any samples of your updates in action?


I'll PM you a link...
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: Forum sig

Postby dazbobaby » Mon Aug 20, 2012 10:26 am

made a few minor changes:
Randomised the "nothing" image.
Added a hit counter - purely for curiousity

nothing:
Code: Select all
      //If user is offline, or the last file has finished playing...
nothing:
$imageList = array("graveyard.png","pushthebutton.png","worldmap.png","record.png","fantasy.png","couch.png","tron.png","eye.png","dancer.png","hifi.png","mask.png","storm.png");
$image = imagecreatefrompng($imageList[rand(1,count($imageList))-1]);
$end = imagealphablending($image, true);
$save = imagesavealpha($image, true);
$color = imagecolorallocate($image, 0, 0, 0);
$font = getcwd()."/Capture it.ttf";
$fontSize = 14;
//text location
$x = 7;
$y = 20;
$fontRotation = 0;
$str = "Your IP Address is $_SERVER[REMOTE_ADDR]";
//$str = "Your browser is $_SERVER[HTTP_USER_AGENT]";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
$x = 5;
$y = 18;
$color = imagecolorallocate($image, 255, 255, 255);       
$fontRotation = 0;
$str = "Your IP Address is $_SERVER[REMOTE_ADDR]";
  //$str = "Your browser is $_SERVER[HTTP_USER_AGENT]";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
imagettftext($image, 14, 0, 8, 148, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $time);
$strnot = "Not Watching Or Listening to Anything Right Now";
imagettftext($image, 14, 0, 5, 145, imagecolorallocate($image, 0, 0, 0), getcwd()."/Capture it.ttf", $time);
$strnot = "Not Watching Or Listening to Anything Right Now";
imagettftext($image, 10, 0, 140, 78, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $strnot);
$strwww = "www.Mess-Hall.co.uk";
imagettftext($image, 14, 0, 371, 136, imagecolorallocate($image, 30, 30, 30), getcwd()."/Capture it.ttf", $strwww);
$strwww = "www.Mess-Hall.co.uk";
imagettftext($image, 14, 0, 370, 135, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $strwww);
$strtag = "A Small Review of Almost Everything";
imagettftext($image, 8, 0, 377, 146, imagecolorallocate($image, 30, 30, 30), getcwd()."/Capture it.ttf", $strtag);
$strtag = "A Small Review of Almost Everything";
imagettftext($image, 8, 0, 376, 145, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $strtag);
// Uncomment the next line (remove //) to display the number of hits on your page.
//echo $hits;
  //hits text location
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);
imagepng($image);
imagedestroy($image);
exit();


hit Counter:
Code: Select all
$xml = @simplexml_load_file("http://".$server."/rest/getNowPlaying.view?u=".$admin."&p=".$adminpass."&v=1.5.0&c=signature");
if($xml==false) {
goto offline;
}

// Hitcounter
$filename = 'hitcountdayz.txt';
$handle = fopen($filename, 'r');
$hits = trim(fgets($handle)) + 1;
fclose($handle);

$handle = fopen($filename, 'w');
fwrite($handle, $hits);
fclose($handle);


If anyone can get the hit counter to display correctly PLMK, I tried for a couple of hours yesterday and struggled like mad, displaying it worked, but it broke the rest of the code.
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby gurutech » Sun Sep 16, 2012 11:20 pm

For those who were interested in upgrading to 4.7 Subsonic, this mod will still work with no extra steps after upgrading, but I would suggest making a backup just in case. It worked for me, without having to change anything with the signature mod.
Image
gurutech
 
Posts: 492
Joined: Sun Jan 15, 2012 9:56 pm

Re: Forum sig

Postby dazbobaby » Mon Sep 17, 2012 1:25 pm

I've yet to upgrade, but as Guru said, there's not going to be a problem.
BTW Gurutech, how come you're not showing off your signature?
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby gurutech » Mon Sep 17, 2012 1:57 pm

dazbobaby wrote:I've yet to upgrade, but as Guru said, there's not going to be a problem.
BTW Gurutech, how come you're not showing off your signature?



I do show it off, just not here... lol

I have it on a truck forum I'm a part of, and they have size limitations on how big the signature file can be (500x100), so it looks small compared to what the rest of the ones here look like. Guess I suffer from "signature envy"... lol
Image
gurutech
 
Posts: 492
Joined: Sun Jan 15, 2012 9:56 pm

Re: Forum sig

Postby dazbobaby » Mon Sep 17, 2012 2:04 pm

just recode to that size.
Or do as I do, I have 4 sets of images and code for various forums.
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby dazbobaby » Sat Jun 03, 2023 2:33 pm

I haven't used it in years and as such it needed some tweaking.


Code: Select all
<?php
//setup error log
ini_set("log_errors", 1);
ini_set("error_log", "php-error.log");
// end error log

  //First collect some data:
$user = "admin"; //user to monitor
$admin = "admin"; //user to get nowPlaying list
$adminpass = "AdminPassword"; //pass to get nowPlaying list (plain or using enc:)
$server = "123.123.123.123:3060"; //Your subsonic server
$xml = @simplexml_load_file("http://".$server."/rest/getNowPlaying.view?u=".$admin."&p=".$adminpass."&v=1.16.1&c=sig_php");
if($xml==false) {
goto offline;
}

// Hitcounter
//$filename = 'hitcountdayz.txt';
//$handle = fopen($filename, 'r');
//$hits = trim(fgets($handle)) + 1;
//fclose($handle);

//$handle = fopen($filename, 'w');
//fwrite($handle, $hits);
//fclose($handle);
//Timestamp
//Different Timezones supported: http://phptutorial.info/?timezones
date_default_timezone_set('Europe/London');
$time = "Local Time: ".date(" M: d: 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) {
   $duration = floor($second_gen['duration']/10);
   if($second_gen['username']  ==  $user and $second_gen['minutesAgo']<=$duration) {
      if($second_gen['contentType'] && substr(  $second_gen['contentType'], 0, 5 ) == "audio") {
         goto playing;
      }else{
         goto nothing;
      }
   }
}

      //If user is offline, or the last file has finished playing...
nothing:
$imageList = array("notmusic1.png","notmusic2.png","music1.png","music2.png","music3.png","music4.png","music5.png","music7.png","music8.png","music10.png");
$image =  imagecreatefrompng($imageList[rand(1,count($imageList))-1]);
$end = imagealphablending($image, true);
$save = imagesavealpha($image, true);
$color = imagecolorallocate($image, 0, 0, 0);
$font = getcwd() .DIRECTORY_SEPARATOR. "happy.ttf";

$fontSize = 14;
  //text location
  //Text Position x=horizontal y=vertical
$x = 7;
$y = 20;
$fontRotation = 0;
$str = "Your IP Address is $_SERVER[REMOTE_ADDR]";
  //$str = "Your browser is $_SERVER[HTTP_USER_AGENT]";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
$x = 5;
$y = 18;
$color = imagecolorallocate($image, 255, 255, 255);       
$fontRotation = 0;
$str = "Your IP Address is $_SERVER[REMOTE_ADDR]";
  //$str = "Your browser is $_SERVER[HTTP_USER_AGENT]";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);

imagettftext($image, 14, 0, 572, 18, imagecolorallocate($image, 0, 0, 0), $font, $hits);
imagettftext($image, 14, 0, 570, 16, imagecolorallocate($image, 255, 255, 255), $font, $hits);
   
imagettftext($image, 14, 0, 7, 147, imagecolorallocate($image, 0, 0, 0), $font, $time);
imagettftext($image, 14, 0, 5, 145, imagecolorallocate($image, 255, 255, 255), $font, $time);

// Because Music Won't Play Itself
$strnot = "Because Music Won't Play Itself";
imagettftext($image, 24, 0, 74, 84, imagecolorallocate($image, 0, 0, 0), getcwd() .DIRECTORY_SEPARATOR. "cowboy.ttf", $strnot);
imagettftext($image, 24, 0, 72, 82, imagecolorallocate($image, 255, 255, 255), getcwd() .DIRECTORY_SEPARATOR. "cowboy.ttf", $strnot);


$strwww = "https://Daz-DJ.UK";
imagettftext($image, 14, 0, 386, 136, imagecolorallocate($image, 30, 30, 30), $font, $strwww);
$strwww = "https://Daz-DJ.UK";
imagettftext($image, 14, 0, 385, 135, imagecolorallocate($image, 255, 255, 255),$font, $strwww);
$strtag = "Banging House Music DJ!";
imagettftext($image, 8, 0, 415, 147, imagecolorallocate($image, 30, 30, 30),$font, $strtag);
$strtag = "Banging House Music DJ!";
imagettftext($image, 8, 0, 416, 146, imagecolorallocate($image, 255, 255, 255),$font, $strtag);
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:
$imageList = array("balloon.png","dj-daz.png","dj-daz.png","dj-daz.png","daz-dj1.png","daz-dj2.png","daz-dj3.png","dj23.png","dj1.png","dj2.png","dj4.png","dj5.png","dj6.png","dj7.png","dj8.png","dj9.png","dj10.png","dj11.png","dj12.png","dj13.png","dj14.png","dj15.png","dj16.png","dj17.png","dj19.png","dj21.png");
$image = imagecreatefrompng($imageList[rand(1,count($imageList))-1]);
$end = imagealphablending($image, false);
$save = imagesavealpha($image, true);

//Get the cover art
//$imageList2 = array("ASTRONEER.gif","astroneer2.gif","astroneer3.gif");
//$image2 = imagecreatefromgif($imageList2[rand(1,count($imageList))-1]);



$coverart = "http://".$server."/rest/getCoverArt.view?u=".$admin."&p=".$adminpass."&v=1.16.1&c=signature&id=".$second_gen['coverArt']."&size=135";
file_put_contents("coverart_url.log",$coverart);
$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);
if (strpos($rawdata,'status="failed"')!==false)
{
    $fallback_images = array("image1.png","image2.png","image3.png","image4.png","image5.png","image6.png","image7.png");
    $image2 = imagecreatefrompng($fallback_images[rand(0,count($fallback_images)-1)]);
}
else
{
    $image2 = imagecreatefromstring($rawdata);   
}

curl_close($ch);

//Text Position x=horizontal y=vertical
//text colour
$color = imagecolorallocate($image, 0, 205, 255);
$font = getcwd() .DIRECTORY_SEPARATOR. "trucking.ttf";
$fontSize = 10;
$fontRotation = 0;
$x = 154;
$y = 96;
// $image = imagealphablending($str, true);

$end = imagealphablending($image, true);
$str = "Listening to\nArtist: ".$second_gen['artist']."\nTitle: ".$second_gen['title']."\nAlbum: ".$second_gen['album'];
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);


//imagettftext($image, 14, 0, 572, 18, imagecolorallocate($image, 0, 0, 0), getcwd() .DIRECTORY_SEPARATOR. "Capture-it.ttf", $hits);
//imagettftext($image, 14, 0, 570, 16, imagecolorallocate($image, 255, 255, 255), getcwd() .DIRECTORY_SEPARATOR. "Capture-it.ttf", $hits);
//imagettftext($image, 12, 0, 150, 280, imagecolorallocate($image, 255, 255, 255), $font, $time);
$strwww = "Daz-DJ.UK";
imagettftext($image, 16, 0, 265, 19, imagecolorallocate($image, 80, 80, 255), $font, $strwww);
$strtag = "Banging House Music DJ!";
//imagettftext($image, 10, 00, 241, 34, imagecolorallocate($image, 255, 255, 255), $font, $strtag);
imagettftext($image, 10, 00, 240, 33, imagecolorallocate($image, 80, 80, 255), $font, $strtag);

// ** IMPORTANT **
// Corodinates are as follows: 10 is font size, 0 is ROTATION, 240 is the horizontal location, 33 is the vertical //
// ** IMPORTANT **
// End of drop shadow test

//Cover art location
imagecopy($image, $image2, 8, 7, 0, 0, 135, 135);
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:     
$imageList = array("dj1.png","dj2.png","dj3.png","dj4.png","dj6.png","dj7.png","dj8.png","dj9.png","dj10.png","dj11.png","dj12.png","dj13.png","dj14.png","dj15.png","dj16.png","dj17.png","dj18.png","dj19.png","dj20.png","dj21.png","dj22.png","dj11.png");
$image = imagecreatefrompng($imageList[rand(1,count($imageList))-1]);
$color = imagecolorallocate($image, 255, 255, 255);
$end = imagealphablending($image, false);
$save = imagesavealpha($image, true);
$font = getcwd()."Capture-it.ttf";
$fontSize = 12;
$x = 10;
$y = 55;
$str = "Now Watching\n".$second_gen['title'];
imagealphablending($image, false);
imagesavealpha($image, true);
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("graveyard.png");
//$color = imagecolorallocate($image, 255, 255, 255);
//$font = getcwd()."cowboy.ttf";
//$fontSize = 16;
//$fontRotation = -7;
//$x = 160;
//$y = 65;
//$str = "Aliens stole my Server. Call the feds!";
//imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
//imagettftext($image, 12, 0, 65, 295, imagecolorallocate($image, 230, 49, 150), getcwd()."/trucking.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();

    //If the server is offline (404)...
offline:
$image = imagecreatefrompng("graveyard1.png");
$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."/trucking.ttf";
$fontSize = 16;
$fontRotation = 0;
//Text Position x=horizontal y=vertical
$x = 158;
$y = 120;
$str = "The server seems to be down!";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
imagettftext($image, 12, 0, 15, 295, imagecolorallocate($image, 230, 49, 150), getcwd()."/trucking.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();
?>
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Previous

Return to Mods, Apps and Clients

Who is online

Users browsing this forum: No registered users and 30 guests