New Signature Pic feature [FEEDBACK]

Want to help out? Need help accessing the AniDB API? This is the place to ask questions.

Moderator: AniDB

GIJOE98
Posts: 1
Joined: Mon Sep 04, 2006 1:02 am

Post by GIJOE98 » Mon Sep 04, 2006 2:42 am

interesting idea... wrote a similiar application for myself a while back... no real web interface since i wanted to have automated updates i just wrote a program in vb to update the datebase via php.. the php backend was rather simple and has support for multiple users but no registration, cache, or web ui to speak of... anyway... i can offer help or ideas if needed...

ex.
http://www.fredericaspage.com/joesjunk/ ... ?u=GIJOE98
hmm... this board doesn't support dynamic urls?

JOE

User avatar
cenedra
Posts: 18
Joined: Wed Jul 26, 2006 5:58 am
Location: SW Virginia
Contact:

Post by cenedra » Mon Sep 04, 2006 4:08 am

hey, man, that does look pretty nice....

but i still would like to do 'my own thing' for my sig.. :cry:
i guess something like that would be ok... did you guys already decide on dimensions and all that? i can't really remember, lol


CeNedra

KnightAR
Posts: 18
Joined: Mon Oct 06, 2003 3:24 am
Contact:

Post by KnightAR » Tue Sep 12, 2006 9:17 pm

Has anyone steped up and started coding this yet?

(I wouldnt mind doing it but my time is limited and it might take a while)

User avatar
HiEv
Posts: 82
Joined: Fri Sep 08, 2006 3:34 am

Post by HiEv » Fri Sep 15, 2006 6:35 pm

Cyrano423 wrote:K ... I need a bit of clarification. What's the purpose of the database on the sig server?
[...]
So I'm wondering if I'm missing something. As I can't see any information that would need to be written or stored to the database. It wouldn't need access to modify or even read from the anidb, since nothing's written ... and all the information needed is given in the XML file / feed.
That's great if you want to access that data from the AniDB site every time, but wouldn't it make more sense to cache that data so that you decrease the load on both servers and speed up the display of the images? Imagine a page in a popular forum where someone using one of these sigs made several posts. Do you really want to rebuild that image from scratch every time it's shown for each person who views it?

They even mentioned caching the data right in the news section on the main page, so you will need some sort of database to cache the signatures in. If you store the username, the image, and the date/time that the image was created, then you can simply reuse that image unless it's too out of date. Whoever does this will probably also want to make something that periodically clears out the old data, but that's one thing you'll definitely want to use a database for.

User avatar
EvoGT
Posts: 8
Joined: Fri Sep 29, 2006 10:57 pm
Contact:

Post by EvoGT » Fri Sep 29, 2006 11:23 pm

KnightAR wrote:Has anyone steped up and started coding this yet?

(I wouldnt mind doing it but my time is limited and it might take a while)
yes I have.

http://manga-network.de/sig/improved/sig.php

the image is also cached (variable time), but i don't use a DB yet, because
I need to know what kind of DB and entries.

User avatar
ruxkor
Posts: 6
Joined: Mon Jul 17, 2006 10:57 am
Contact:

Post by ruxkor » Tue Oct 03, 2006 11:53 pm

cenedra wrote:hey, man, that does look pretty nice....

but i still would like to do 'my own thing' for my sig.. :cry:
i guess something like that would be ok... did you guys already decide on dimensions and all that? i can't really remember, lol


CeNedra
if you really are keen on doing it (putting your own background behind the stats) if you have a bit of skill in any language that can serve for image creation (lets say php with the gd library) you can dynamically generate your own pic by fetching the dynamically generated picture from the anidb (this picture will have a transparent background i hope or it should be at least configurable) and combining it with your static background.

should be max. 20 minutes of work, also not knowing nothing about the gd, there are really great tutorials around.. :wink:

although it should be possible for the sig server to host this image and combine it for you, i think it would be impossible to include it because of the traffic it would cause:
a 600*50 png with a one color font and text to cover the whole space is approx 2KB big. it would be approx. 50 times heavier if you could include your own background (ca. 100KB)

User avatar
EvoGT
Posts: 8
Joined: Fri Sep 29, 2006 10:57 pm
Contact:

Post by EvoGT » Wed Oct 04, 2006 7:00 pm

ruxkor wrote:
cenedra wrote:hey, man, that does look pretty nice....

but i still would like to do 'my own thing' for my sig.. :cry:
i guess something like that would be ok... did you guys already decide on dimensions and all that? i can't really remember, lol


CeNedra
if you really are keen on doing it (putting your own background behind the stats) if you have a bit of skill in any language that can serve for image creation (lets say php with the gd library) you can dynamically generate your own pic by fetching the dynamically generated picture from the anidb (this picture will have a transparent background i hope or it should be at least configurable) and combining it with your static background.

should be max. 20 minutes of work, also not knowing nothing about the gd, there are really great tutorials around.. :wink:

although it should be possible for the sig server to host this image and combine it for you, i think it would be impossible to include it because of the traffic it would cause:
a 600*50 png with a one color font and text to cover the whole space is approx 2KB big. it would be approx. 50 times heavier if you could include your own background (ca. 100KB)
there is no problem to check the size of custom backgrounds. ;)
i already use a transparent pic, created from the xml and then
combine it with the bg ;)

Gemberkoek
Posts: 13
Joined: Sun Oct 15, 2006 12:55 pm

Post by Gemberkoek » Tue Oct 17, 2006 12:26 am

*Steps up to the plate*

*opens mouth*
Please either shut up and code or shut up and don't code.
*closes it again and starts coding*

Something like this:

Code: Select all

<?php

//Sig server code

include("db.php"); //Loads database

$user_ID = $_GET["id"]; //What user do we want a sig for?

$result = MySQL_QUERY("SELECT * FROM configoptions WHERE user_ID = '".$user_ID."'");
$arr_configoptions = mySQL_FETCH_ARRAY($result);
header("Content-type: image/png");
//Add imagecreatefromjpg/gif/bmp/whathaveyou...
$im    = imagecreatefrompng("images/".$arr_configoptions["imageURL"].".png"); //OR: $im    = imagecreatefrompng("images/sig".$arr_configoptions["user_ID"]".png");
//Add specific data, use configoptions to see if they are on and where and how (color, font) they are placed
//Propably something like read_file(animedb.pl?show=xml&user=username&data=data);
//find_data und put them in a variable
//print variable via imagetext or imagefttext
imagepng($im);
imagedestroy($im);

?> 

dooly00000
Posts: 28
Joined: Sat Jul 29, 2006 8:10 pm

Post by dooly00000 » Sun Oct 22, 2006 12:19 pm

XML coding, and all this idea... cool. Thing is, I'm still newbie at xml/phpbb codings... --;

I maybe able to help out on other projects or this, if it goes incomplete, when I get the hang of the coding later. I only know HTML/CSS/Javascript as of now.

User avatar
exp
Site Admin
Posts: 2438
Joined: Tue Oct 01, 2002 9:42 pm
Location: Nowhere

Post by exp » Mon Oct 23, 2006 9:28 am

just added two more xml data pages for use by the sig server:

http://anidb.info/perl-bin/animedb.pl?s ... tat&uid=32

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<root>
<userstat uid="32" uname="test"><mylist>
	<acnt>24</acnt>
	<ecnt>105</ecnt>
	<fcnt>109</fcnt>
	<size>21348</size>
	<last>
	<anime aid="106" adddate="1111918024">Azumanga Daiou</anime>
	</last>
</mylist>
<anidb>
<aacnt>0</aacnt>
<eacnt>1</eacnt>
<facnt>1</facnt>
<gacnt>0</gacnt>
<independencep>0</independencep>
<leechp>99</leechp>
<revcnt>0</revcnt>
<votecnt>0</votecnt>
<totalviewedp>0</totalviewedp>
<totalownedp>0</totalownedp>
<ownviewedp>41</ownviewedp>
<viewedepcnt>44</viewedepcnt>
</anidb>
</userstat>
</root>
and

http://anidb.info/perl-bin/animedb.pl?s ... stat&aid=1

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<root>
<animestat aid="1">
	<titles>
<romaji>Seikai no Monshou</romaji><ja>星界の紋章</ja><en>Crest of the Stars</en></titles>
<eps>13</eps>
<rating>847</rating>
<votes>1556</votes>
<tmprating>738</tmprating>
<tmpvotes>63</tmpvotes>
<atts>8</atts>
<attavg>899</attavg>
<ecnt>13</ecnt>
<fcnt>312</fcnt>
<gcnt>22</gcnt>
<ucnt>1961</ucnt>
<size>63741</size>

<lastep eid="1014">
<epno epno="13">13</epno>
<name>Trouble Soaring Through Heaven</name>
<aired>922492800</aired>
<length>40</length>
<rating>833</rating>
<votes>3</votes>
<fcnt>24</fcnt>
<ucnt>1905</ucnt>
</lastep>
</animestat>
</root>
where it is possible to add additional uid and gid parameters (one or both) to get more info:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<root>
<animestat aid="1">
	<titles>
<romaji>Seikai no Monshou</romaji><ja>星界の紋章</ja><en>Crest of the Stars</en></titles>
<eps>13</eps>
<rating>847</rating>
<votes>1556</votes>
<tmprating>738</tmprating>
<tmpvotes>63</tmpvotes>
<atts>8</atts>
<attavg>899</attavg>
<ecnt>13</ecnt>
<fcnt>312</fcnt>
<gcnt>22</gcnt>
<ucnt>1961</ucnt>
<size>63741</size>

<lastep eid="1014">
	<epno epno="13">13</epno>
<name>Trouble Soaring Through Heaven</name>
<aired>922492800</aired>
<length>40</length>
<rating>833</rating>
<votes>3</votes>
<fcnt>24</fcnt>
<ucnt>1905</ucnt>
</lastep>

<mylist uid="32" uname="test">
<epcnt>2</epcnt>
<seen>0</seen>
<spepcnt>0</spepcnt>
<spseen>0</spseen>
<state id="2">on hdd</state>
</mylist>

<group gid="41" gname="Zhentarim DivX" gshortname="zx">
<rating>808</rating>
<votes>24</votes>
<atts>2</atts>
<epcnt>13</epcnt>
<sepcnt>0</sepcnt>
<changed>1134322659</changed>
<state id="3">complete</state>
<lastepno ep="13">13</lastepno>
</group>
</animestat>
</root>
hope it helps.
as always this is not tested well so there might be some random features :o)

BYe!
EXP

Gemberkoek
Posts: 13
Joined: Sun Oct 15, 2006 12:55 pm

Post by Gemberkoek » Mon Oct 23, 2006 1:08 pm

I'd love it if someone could assemble a list of all possible XML tags and their meanings, of course i can find out most myself but if someone could help - onegai?

User avatar
fahrenheit
AniDB Staff
Posts: 438
Joined: Thu Apr 08, 2004 1:43 am
Location: Portugal

Post by fahrenheit » Mon Oct 23, 2006 1:54 pm

for the xml tags you can get a few pointers by reading the mylist export info

http://wiki.anidb.info/w/Mylist_export_ ... guidelines

most of the vars are the same

Gemberkoek
Posts: 13
Joined: Sun Oct 15, 2006 12:55 pm

Post by Gemberkoek » Mon Oct 23, 2006 6:26 pm

Code: Select all

<?php 

//Sig server code 

include("db.php"); //Loads database 

$user_ID = $_GET["id"]; //What user do we want a sig for? 

header("Content-type: image/png"); 
if(file_exists("images/sig".$user_ID.".png"))
{
$im    = imagecreate(600,50); 
$im2    = imagecreatefrompng("images/sig".$user_ID.".png"); 
imagecopy($im,$im2,0,0,0,0,600,50);
}else{
$im     = imagecreate(600,50);
}
$white = imagecolorallocate($im, 255,255,255);
//First let's allocate some colors
$result = MySQL_QUERY("SELECT configoptions_color FROM configoptions WHERE configoptions_uid = ".$user_ID." GROUP BY configoptions_color");
while($arr_colors = MySQL_FETCH_ARRAY($result))
{
 $red = hexdec(substr($arr_colors["configoptions_color"],0,2));
 $green = hexdec(substr($arr_colors["configoptions_color"],2,2));
 $blue = hexdec(substr($arr_colors["configoptions_color"],4,2));
 $$arr_colors["configoptions_color"] = imagecolorallocate($im, $red,$green,$blue);
}
//Now let's find out what data we should look for.
$result = MySQL_QUERY("SELECT configoptions_data FROM configoptions WHERE configoptions_uid = ".$user_ID."");
while($arr_data = MySQL_FETCH_ARRAY($result))
{
while($found = strpos($arr_data["configoptions_data"],"["))
{
if($found2 = strpos($arr_data["configoptions_data"],"]",$found))
{
 
}

}
}



//Add specific data, use configoptions to see if they are on and where and how (color, font) they are placed 
//Propably something like read_file(animedb.pl?show=xml&user=username&data=data); 
//find_data und put them in a variable 
//print variable via imagetext or imagefttext 
imagepng($im); 
imagedestroy($im); 

?> 

User avatar
EvoGT
Posts: 8
Joined: Fri Sep 29, 2006 10:57 pm
Contact:

Post by EvoGT » Tue Oct 24, 2006 1:20 pm

ok, seems there is no need for my script :D
Image

Gemberkoek
Posts: 13
Joined: Sun Oct 15, 2006 12:55 pm

Post by Gemberkoek » Tue Oct 24, 2006 1:57 pm

I'm still working on it, any help would be greatly appreciated as i've got a school to attend to as well...

Locked