Forum sig

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

Moderator: moderators

Re: Forum sig

Postby dazbobaby » Sat Apr 21, 2012 10:56 am

SparkyRih wrote:I wanted to put my last tweet in this signature... but since my twitter account is protected it's a little bit harder :P



Now you're just showing off y0r l33t 5k1lls
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby dazbobaby » Fri Apr 27, 2012 9:04 pm

seeing as you're better at this than me Sparky, any idea how to input and output PNG transparency?
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby dazbobaby » Fri Apr 27, 2012 10:31 pm

for anyone interested, here is my signature.php customised for 600x150px random images:
Code: Select all
<?php
//First collect some data:
$user = "UserName"; //user to monitor
$admin = "Admin UserName"; //user to get nowPlaying list
$adminpass = "Admin Password"; //pass to get nowPlaying list (plain or using enc:)
$server = "localhost:8080"; //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
//Different Timezones supported: http://phptutorial.info/?timezones
date_default_timezone_set('Europe/London');
$time = "My local time: ".date("l: D: 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) {
$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("notdoinganything.png");
$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."/Capture it.ttf";
$fontSize = 14;
//text location
$x = 5;
$y = 18;
$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);
//Time location
imagettftext($image, 14, 0, 5, 145, imagecolorallocate($image, 255, 255, 255), 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);
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();


//If the user is playing a music file...
playing:
$imageList = array("music1.png","music2.png","music3.png","music4.png","music5.png","music6.png","music7.png","music8.png","music9.png","music10.png");
$image = imagecreatefrompng($imageList[rand(1,count($imageList))-1]);
//$image = imagecreatefrompng("itunes_sig.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=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
$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."/aliee13.ttf";
$fontSize = 10;
$fontRotation = -0;
$x = 155;
$y = 97;
$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);
//Cover art location
imagecopy($image, $image2, 0, 0, 0, 0, 150, 150);
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("music1.png","music2.png","music3.png","music4.png","music5.png","music6.png","music7.png","music8.png","music9.png","music10.png");
$image = imagecreatefrompng($imageList[rand(1,count($imageList))-1]);
//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
$color = imagecolorallocate($image, 250, 250, 90);
$font = getcwd()."/aliee13.ttf";
$fontSize = 10;
$fontRotation = -0;
$x = 155;
$y = 97;
$str = "Trasfixed to the gogglebox\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, 65, 295, imagecolorallocate($image, 230, 49, 150), getcwd()."/aliee13.ttf", $time);
//Cover art location
imagecopy($image, $image2, 0, 0, 0, 0, 150, 150);
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("music1.png");
$color = imagecolorallocate($image, 255, 255, 255);
$font = getcwd()."Capture it.ttf";
$fontSize = 16;
$fontRotation = -7;
$x = 160;
$y = 65;
$str = "My server seems to be down...";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
imagettftext($image, 12, 0, 65, 295, imagecolorallocate($image, 230, 49, 150), getcwd()."/aliee13.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

Re: Forum sig

Postby SparkyRih » Sun Apr 29, 2012 2:02 pm

dazbobaby wrote:seeing as you're better at this than me Sparky, any idea how to input and output PNG transparency?


I guess you're looking for this function?
http://www.php.net/manual/en/function.i ... parent.php

Example:
http://develop.schattorie.nl/signatures ... c/test.php
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 » Sun Apr 29, 2012 2:42 pm

I don't think so, isn't that taking one colour and making it transparent?

What I was thinking is keeping transparency from an original:
music6.png


And making the sig code keep it after it's added artwork and text.
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby SparkyRih » Sun Apr 29, 2012 3:28 pm

I see, it doesn't work... let me have a look...

Edit: This is what you wanted ;)
http://develop.schattorie.nl/signatures ... c/test.php
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 gurutech » Tue May 01, 2012 9:07 pm

Quick questions on this forum signature....

Can it be used on ANY forum, or only on this one?
If I post something in a forum, and the .jpg file is linked to in the image, will that image actually "change" if I am listening to another song, or to no song at all? (ie. if I am listening to "Metallica - One" when I post a message, then the following day, I go back to the thread I posted in, but am not currently listening to anything, will it still show I am listening to Metallica, or would it now say I am not listening to anything?

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

Re: Forum sig

Postby SparkyRih » Tue May 01, 2012 9:33 pm

gurutech wrote:Quick questions on this forum signature....

Can it be used on ANY forum, or only on this one?
If I post something in a forum, and the .jpg file is linked to in the image, will that image actually "change" if I am listening to another song, or to no song at all? (ie. if I am listening to "Metallica - One" when I post a message, then the following day, I go back to the thread I posted in, but am not currently listening to anything, will it still show I am listening to Metallica, or would it now say I am not listening to anything?

Thanks!


If you're allowed to link to a "remote image", than the answer is simply yes...

The image you see below doesn't really exist, it's generated at the moment you load or refresh this page...
The background is a real image, but the text (and coverart image if I'm actually listening to something) on it is printed on it by my script...

1. The browser asks my server for signature.png.
2. I told the server that signature.png is actually signature.php (using a little script), so my server runs the script
3. the script asks subsonic for the data and gives real image data back to the browser
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 gurutech » Sun May 06, 2012 12:37 am

ok, I have the signature files copied to a ./signatures folder, and I modified the script, and if I browse to the URL I can see the correct image, however I do not see any text on the image at all.

I tried all three of the standard images (that came with your script), and can view each of them, but no text on any of them.

I tried going through the signature.php file and it looks like there are some x and y parameters to specify the starting point for the text, which I have left at the default (160, 65).

I did resize the actual back2.png file so it would fit within the specs on the forum I wanted to use it on (510x100 max, ended up as 434x100)
Image
gurutech
 
Posts: 492
Joined: Sun Jan 15, 2012 9:56 pm

Re: Forum sig

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

gurutech wrote:ok, I have the signature files copied to a ./signatures folder, and I modified the script, and if I browse to the URL I can see the correct image, however I do not see any text on the image at all.

I tried all three of the standard images (that came with your script), and can view each of them, but no text on any of them.

I tried going through the signature.php file and it looks like there are some x and y parameters to specify the starting point for the text, which I have left at the default (160, 65).

I did resize the actual back2.png file so it would fit within the specs on the forum I wanted to use it on (510x100 max, ended up as 434x100)


I've answered your question in the other topic ;)
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 May 07, 2012 6:35 pm

SparkyRih wrote:I see, it doesn't work... let me have a look...

Edit: This is what you wanted ;)
http://develop.schattorie.nl/signatures ... c/test.php


yep that's the one!
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

Postby dazbobaby » Sat May 12, 2012 10:31 am

Testing alpha:
Image

PHP updates:
Code: Select all
    //If the user is playing a music file...
playing:
$imageList = array("music1.png","music2.png","music6.png","music10.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
$color = imagecolorallocate($image, 255, 0, 0);
$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);
    //Cover art location
imagecopy($image, $image2, 2, 2, 0, 0, 145, 145);
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();
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

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

My latest release has image tranparency by default now :)

I'm working on a multiuser plugin for my subsonic registration engine now...
This plugin will make it possible for every registered user to create their own image via a webpage...
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 1:08 pm

Nice going Sparky, I'm currently working on drop shadow, something impossible in GD2 (or so I've heard).
I tried imageconvolution with Gaussian blur but failed, so instead I'm trying to replicate the text, darken it, and move it slightly to create the effect of a drop shadow.

Throw me a rope I'm going in
Image
User avatar
dazbobaby
 
Posts: 68
Joined: Tue Dec 06, 2011 12:29 pm

Re: Forum sig

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

dazbobaby wrote:Nice going Sparky, I'm currently working on drop shadow, something impossible in GD2 (or so I've heard).
I tried imageconvolution with Gaussian blur but failed, so instead I'm trying to replicate the text, darken it, and move it slightly to create the effect of a drop shadow.

Throw me a rope I'm going in


Nice one :D
let me know if you have some result...
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 29 guests