Forum Settings
Forums
New
Pages (4) « 1 [2] 3 4 »
Dec 27, 2008 5:19 PM

Offline
Feb 2008
4295
Cloud1234: If you're asking about 000webhost, afaik the checks only happen once. I've been using them for a couple of months now and the only time they checked my site was when it started receiving visitors and never again.

Mukyaa: Which host are you using and please post a link the the sig_creator.php so we can see the error output.
Dec 27, 2008 5:33 PM

Offline
Oct 2007
879
[http://tjs.nextgenwebhosting.com/signature/sig_creator.php]My sig_creator.php[/url]

I got my hosting from a friend.
It has cPanel, 1GB Space and 5GB Monthly Bandwidth.
Dec 27, 2008 5:45 PM

Offline
Feb 2008
4295
Try setting the folder to 757, it seems your host doesn't like group writing permissions for some reason. If that doesn't work I've got nothing.

Edit: Some googling revealed this to be a likely cause and if this doesn't work you might need to set the permissions to 755.
Dec 27, 2008 5:47 PM

Offline
Oct 2007
879
kuroshiroi said:
Try setting the folder to 757, it seems your host doesn't like group writing permissions for some reason. It that doesn't work I've got nothing.


Did that and got
"Internal Server Error

Directory "/home/tjsnext/public_html/signature" is writeable by others"
Dec 27, 2008 5:48 PM

Offline
Feb 2008
4295
Hehe, just edited it, try 755.
Dec 27, 2008 5:51 PM

Offline
Oct 2007
879
thanks now it works...
just need to make it now

EDIT: I made it! Hopefully it's alright as my first sig.
Now another question, how do I get the score information from my list?
subishiroDec 29, 2008 11:16 AM
Dec 30, 2008 4:07 AM

Offline
Apr 2008
78
i'm at work right now, so im bound to give you just a short answer (hope it helps anyway)

some hints:
- you will need several layers:

  • 1st layer: bgimage [this will be the base of your image, all other layers have to be copied on top of that]
  • 2nd layer: Animetext
  • 3rd layer: foreground image

- you have to merge and copy the layers to get the final image
merging can be done with:
ImageCopyMerge ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h , int $pct )
copy-pasting of images is done with:
ImageCopy ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h )

I might make a sequel to this Tutorial where i will explain how to achieve such things like image rotation, multiple layers and advanced text effects.
For now you can find an example how to handle multiply layers in KHobbit*s signature script (find it here
Luck is the last dying wish of those who wanna believe that winning can happen by accident, sweat on the other hand is for those who know it's a choice, so decide now because destiny waits for no man.
Dec 30, 2008 6:26 AM

Offline
Feb 2008
4295
I'm chiming in, since I can hopefully be of some help.

I played around with shiteiru's code and basically this is the order you'll want your code to be, I think everything's included:
---------------------------------------------------------------------------------------
//generate the image
$blub = imagecreatefrompng('bgimg.png');
------
here be random function for image.
------

//imagecolorexact(image, red(between 0 and 255), green, blue)
//imagecolorexact($blub,0,0,0) = black font | imagecolorexact($blub,255,255,255) = white font
$colour = imagecolorexact($blub,0,0,0);
$font = 'Capture_it.ttf';

//imagefttext(image, font size, angle, x-pos(relative to the image in px), y-pos, font color, fontfile, text output)
imagefttext($blub,14,0,118,48,$colour,$font,$titles[0]);
imagefttext($blub,12,0,170,60,$colour,$font,$status[0]);

// Copy
imagecopy($blub, $src, 0, 0, 0, 0, 600, 140);

imagepng ($blub); //we want our final image to be in the png format
---------------------------------------------------------------------------------------

and then this is the randomizing code, stolen and modified from my own code.
---------------------------------------------------------------------------------------
$num = rand(0,2);
switch($num)
{
case 0:
$src = imagecreatefrompng ('chie_face.png');
break;
case 1:
$src = imagecreatefrompng ('chie_chest.png');
break;
case 2:
$src = imagecreatefrompng ('chie_leg.png');
break;
default:
$src = imagecreatefrompng ('chie_face.png');
}
---------------------------------------------------------------------------------------
It's not fancy but it works and it's plenty for this application.

If you want to change something else besides the image, such as font colors and such you can just cut and paste code into the switch as needed.

I hope this helps.

Edit: I'm actually doing this a little differently though, for instance the Haruhi image in this sig is not two different images, just one that I move around with the y coordinates of imagecopy, so you can probably do something similar using the switch.
Unnecessary feature: http://kuroshiroi.net78.net/malsig/kuro.php?sig=haruhi&ver=60
I can even move her around using the url ;)
kuroshiroiDec 30, 2008 6:37 AM
Dec 30, 2008 7:21 AM

Offline
Dec 2007
218
So switch() is a conditioning statement. As long as the random number created by rand() equals the number after case, it displays an image. Just like the select statement in VB :)
Dec 30, 2008 7:41 AM

Offline
Feb 2008
4295
Fara7 said:
So switch() is a conditioning statement. As long as the random number created by rand() equals the number after case, it displays an image. Just like the select statement in VB :)
Yup, I actually tried to use select at first but that didn't really work :)
The only real difference is that php's switch needs the break; command to work like select does. That threw me off for a while.
Dec 30, 2008 5:08 PM

Offline
Feb 2008
4295
The switch needs to be above this line:

imagecopy($blub, $src, 0, 0, 0, 0, 600, 140);

and not at the bottom. I should probably have just pasted it together in the right order myself but I thought I would try to show you how the switch works first.

I'm surprised you're not getting an error actually :)
Dec 30, 2008 5:11 PM

Offline
Oct 2006
1569
At first glance, I'm thinking your problem is that this bit
<pre>$num = rand(0,2);
switch($num)
{
case 0:
$src = imagecreatefrompng ('chie_face.png');
break;
case 1:
$src = imagecreatefrompng ('chie_chest.png');
break;
case 2:
$src = imagecreatefrompng ('chie_leg.png');
break;
default:
$src = imagecreatefrompng ('chie_face.png');

Needs to go above this bit
<pre>// Copy
imagecopy($blub, $src, 0, 0, 0, 0, 600, 140);

imagepng ($blub); //we want our final image to be in the png format


The former chooses which image to overlay and the latter copies it over and saves out the signature, so if you've got them reversed you're pasting in the overlay image and saving the result before there's anything there.

[edit] Looks like I'm too slow to be useful =P
Dec 30, 2008 5:28 PM

Offline
Feb 2008
4295
Krelian: Nothing wrong with bashing windy over the head with a wall of text :)
Dec 31, 2008 2:37 AM

Offline
Oct 2008
390
Is there any way to limit my output characters?

Example: I have "Code Geass - Hangyaku no Lelouch" and I want it to show 15 characters so it should look like this "Code Geass - Han..."
Dec 31, 2008 4:30 AM

Offline
Apr 2007
1609
Ripaz said:
Is there any way to limit my output characters?

Example: I have "Code Geass - Hangyaku no Lelouch" and I want it to show 15 characters so it should look like this "Code Geass - Han..."

The way I normally do this is through the following method:

$substringanime = substr($animetitle, 0, 15);
imagettftext($image, $fontsize, $angle, $xbasepoint, $ybasepoint, $color, $font, $substringanime);
The second command, the imagettftext, is just the normal one pepole use to put their titles on with the normal parameters. The first one tells it to only use a substring of whatever you were looking at (in this case $animetitle), beginning at position 0 and extending 15 characters. The output of that is used in the next line.

This doesn't handle the ellipsis, though. But you can handle that easily by changing $substringanime in the second line to something like "$substringanime..." (Note that it needs to be in quotes like any other constant text.)

If you'll notice, my current signature is using this technique. The lettering in it is not tracked, but rather every letter you see on it is a substring of 1, and can be individually placed, colored, and moved around however I please. It's a bit more work and lines to add in, but it opens the door a little bit to a few more nontraditional designs.

EDIT: Forgot to mention the ellipsis.
IriDec 31, 2008 5:03 AM
Dec 31, 2008 5:04 AM

Offline
Apr 2008
78
the way Iri mentioned is the most easy and straightforward to do it.
for my script, there's a really easy way to achieve a cutting for all animetitles with just minimal changes...

find this piece of code in the php-file:

//now we have to prepare the information we cached in the $buffer array earlier

//for this we are going to use a for-loop

//this for-loop just extracts the anime_title information

for ($j=1;$j<$i;$j++) {
if ($cnt = strstr($buffer[$j],$title)) { //strstr('string to be searched', 'string to search')
//if the specified string has been found do...
//str_replace('found string', 'replace with', 'replace it in')
//and save it in the variable $ncnt
$ncnt = str_replace($title, "", $cnt);
$end = strstr($ncnt, $titleend); //strstr('string to be searched', 'string to search')
//once again replace a part of the string and save the outcome in a new arrai
$titles[$t] = str_replace($end,"",$ncnt);
$t++;
}

}

and replace it with this one:

//now we have to prepare the information we cached in the $buffer array earlier

//for this we are going to use a for-loop

//this for-loop just extracts the anime_title information

for ($j=1;$j<$i;$j++) {
if ($cnt = strstr($buffer[$j],$title)) { //strstr('string to be searched', 'string to search')
//if the specified string has been found do...
//str_replace('found string', 'replace with', 'replace it in')
//and save it in the variable $ncnt
$ncnt = str_replace($title, "", $cnt);
$end = strstr($ncnt, $titleend); //strstr('string to be searched', 'string to search')
//once again replace a part of the string and save the outcome in a new arrai
$cutter = str_replace($end,"",$ncnt);
$titles[$t] = substr($cutter, 0, 15);

$t++;
}
}

the rest can stay as it was before
the only part that really gets a change is the one i made extra super eye catching with red color

be aware that this change influences all animetitle in our array

Edit: in depth explanation of the used code

  • substr($cutter, 0, 15)

    • substr ( string $string , 'startingpoint in integer' , 'desired length of the whole string specified by integer' )

  • substr: Returns the portion of string specified by the start and length parameters
ehrgeizDec 31, 2008 5:49 AM
Luck is the last dying wish of those who wanna believe that winning can happen by accident, sweat on the other hand is for those who know it's a choice, so decide now because destiny waits for no man.
Dec 31, 2008 7:50 AM

Offline
Dec 2007
218
Thanks all, I found this helpful. I was testing it: here.

Oh, I have a question, how is it possible to output the titles and status on the same line? I tried this:
imagefttext($image,14,0,7,118,$colour,$font,$titles[0].$status[0]);

but still, it moves the status to the next line.
Dec 31, 2008 9:20 AM

Offline
Oct 2008
390


Thanks for help. It works great. Only problem is that someone can mistook anime I'm currently watching (as you see it shows that Im watching Code Geass R2 but it misses R2 so it looks like Im watching 1. season) Is there a way to put code so it shows "..." when title is to big?
Dec 31, 2008 9:58 AM

Offline
Dec 2007
218
I was able figure out how to do this but by using one line (not the info from MAL). Here's the very simple code.
<?php
$string = "Code Geass - Hangyaku no Lelouch R2";

If (strlen($string) > 20)
{
$reqstr = substr($string, 20, strlen($string));
$repstr = str_replace($reqstr, '....', $string);
}

print $repstr;
?>
This is the output: Here.

So something similar has to be done for the titles.

Edit:
I tried it out on the signature code and guess it is done this way.
//prepare the parsed information for the pic
for ($j=1;$j<$i;$j++) {
if ($cnt = strstr($buffer[$j],$title)) {
$ncnt = str_replace($title, "", $cnt);
$end = strstr($ncnt, $titleend);
$string = str_replace($end,"",$ncnt);
if (strlen($string) > 20) {
$required = substr($string, 20, strlen($string));
$replace = str_replace($required,"....",$string);
}
$titles[$t] = $replace;
$t++;

}
}


Strlen() - this returns the length of a string.

I am not much knowledgeable in php but I hope this was helpful.
NotADoctor_Dec 31, 2008 10:34 AM
Dec 31, 2008 8:19 PM

Offline
Oct 2006
1569
Regarding printing the title and status on the same line, that ought to work fine (though you could do with some spaces in there instead of just tacking one string onto the other). I ran into the same problem though - there's a newline character in there that you need to get rid of. The trim function should do the trick nicely there.
Dec 31, 2008 11:55 PM

Offline
Dec 2007
218
It worked :) Thanks!

This is how I used the trim function.
$status[$z] = trim(str_replace($end2,"",$ncnt),"\n");
Jan 1, 2009 3:53 AM

Offline
Jul 2007
2780
Ok im trying to customize the sig you see i have now. But there are some problems.

First of all, as you see i know how to install and use a fond.But the problem is that it works ONLY for "capture_it" and no other. I tried 4-5 different fonts, i uploaded the ttf in the file directory where it should be but still nothing.Why does it work ONLY for "capture it" font? I did everything in the tytorial but still...

Secondly, I want my sig to have more than 1 update.I thought that since with this:
imagefttext($blub,14,45,10,120,$colour,$font,$titles[0]);
imagefttext($blub,13,45,15,137,$colour,$font,$status[0]);

I got one if i did this (with different X-pos of course):

imagefttext($blub,14,45,10,120,$colour,$font,$titles[0]);
imagefttext($blub,13,45,15,137,$colour,$font,$status[0]);
imagefttext($blub,14,45,10,120,$colour,$font,$titles[1]);
imagefttext($blub,13,45,15,137,$colour,$font,$status[1]);

I would get 2 updates... But it doesnt work.

My last problem is how to place dots when the anime is too long. For example now Akane doesnt fit in my sig. I want if it crosses the border to end like this:
Akane-Iru Ni ...

Instead of just going through.

I really need some help :(

Heres my whole script atm- If someone could tell me what to change or to modify it so that will work i would be glad :3

CloudyJan 1, 2009 4:06 AM
Jan 1, 2009 4:01 AM

Offline
Dec 2007
218
What is the extention of the font you are trying to use? If the extension is 'TTF' (in capital letters) it won't work (this happens to me sometimes), so try changing the extension to 'ttf'.

For adding dots to long titles, try what I posted 2 posts above this or wait for someone who knows better to give a better way :)
Jan 1, 2009 4:16 AM

Offline
Oct 2008
390
@Fara7: I replaced this code you gave me, but it doesn't show nothing when I put 2 character number. Only works with 1 character numbers.

EDIT: I just might know where is problem. I think when title is shorter than for example 20 characters it will not show it. I would fix it but PHP is not my better side. Other than that the rest is working fine.
RipazJan 1, 2009 4:39 AM
Jan 1, 2009 4:52 AM

Offline
Apr 2008
78
@ripaz: to show something like 'Code Geass R2' like 'Code Geass...' you will have to do the following tewaks to the code:

find the following code:

for ($j=1;$j<$i;$j++) {
if ($cnt = strstr($buffer[$j],$title)) { //strstr('string to be searched', 'string to search')
//if the specified string has been found do...
//str_replace('found string', 'replace with', 'replace it in')
//and save it in the variable $ncnt
$ncnt = str_replace($title, "", $cnt);
$end = strstr($ncnt, $titleend); //strstr('string to be searched', 'string to search')
//once again replace a part of the string and save the outcome in a new arrai
$cutter = str_replace($end,"",$ncnt);
$titles[$t] = substr($cutter, 0, 15);
$t++;
}
}

and replace it with this:

for ($j=1;$j<$i;$j++) {
if ($cnt = strstr($buffer[$j],$title)) { //strstr('string to be searched', 'string to search')
//if the specified string has been found do...
//str_replace('found string', 'replace with', 'replace it in')
//and save it in the variable $ncnt
$ncnt = str_replace($title, "", $cnt);
$end = strstr($ncnt, $titleend); //strstr('string to be searched', 'string to search')
//once again replace a part of the string and save the outcome in a new arrai
$cutter = str_replace($end,"",$ncnt);
If (strlen($cutter) > 12)
{
$titles[$t] = substr($cutter, 0, 12);
$titles[$t] .= "...";
}
else{
$titles[$t] = str_replace($end,"",$ncnt);
}

$t++;

}

}


the vital parts are marked in red
what it will do: check if a title is longer than 12 characters, if so the loop will be activated, the string will be trimmed and '...' after the 12th character. It is vital that you cut the string after the 12th char cause you want to add 3 dots and get a final counting of 15 to work with.

@cloud:

imagefttext($blub,14,45,10,120,$colour,$font,$titles[0]);
imagefttext($blub,13,45,15,137,$colour,$font,$status[0]);
imagefttext($blub,14,45,10,120,$colour,$font,$titles[1]);
imagefttext($blub,13,45,15,137,$colour,$font,$status[1]);
[/qote]
this should work, try to make the y-pos a little smaller e.g. replace 120 with 50 an 137 with 67 and see if it works


My last problem is how to place dots when the anime is too long. For example now Akane doesnt fit in my sig. I want if it crosses the border to end like this:
Akane-Iru Ni ...

see above, thats the same prob ripaz has...

to the font-problem
if you have something like:
$font = 'Your_Font';
try replacing it with:
$font = Your_Font.ttf';

note that: the font has to be written case-sensitive; also, if the font has another ending than .ttf you will have to write the font plus the ending in case-sensitive letters like in my example above, otherwise it wont work.
ehrgeizJan 1, 2009 5:07 AM
Luck is the last dying wish of those who wanna believe that winning can happen by accident, sweat on the other hand is for those who know it's a choice, so decide now because destiny waits for no man.
Jan 1, 2009 5:07 AM

Offline
Oct 2008
390
Yeah I have done that. Replaced code and now look like this

//this for-loop just extracts the anime_title information
for ($j=1;$j<$i;$j++) {
if ($cnt = strstr($buffer[$j],$title)) { //strstr('string to be searched', 'string to search')
//if the specified string has been found do...
//str_replace('found string', 'replace with', 'replace it in')
//and save it in the variable $ncnt
$ncnt = str_replace($title, "", $cnt);
$end = strstr($ncnt, $titleend); //strstr('string to be searched', 'string to search')
//once again replace a part of the string and save the outcome in a new arrai
$cutter = str_replace($end,"",$ncnt);
If (strlen($cutter) > 32)
{
$titles[$t] = substr($cutter, 0, 32);
$titles[$t] .= "...";
}
$t++;
}
}


Sig looks like this:


Currently watching Akikan! that has 12 characters in total (with TV suffix). I have set 32 characters to cut but when title is shorter than that it will not show it at all. Dunno if I explained well.
Jan 1, 2009 5:09 AM

Offline
Apr 2008
78
fixed the issue in my above post, realized the problem as soon as i posted the solution...

you have to add this part

else{
$titles[$t] = str_replace($end,"",$ncnt);
}
Luck is the last dying wish of those who wanna believe that winning can happen by accident, sweat on the other hand is for those who know it's a choice, so decide now because destiny waits for no man.
Jan 1, 2009 5:12 AM

Offline
Jul 2007
2780
Ok i solved the fond and the 2 updates problem.But the dots just wont show up :3

This is my code what am i doing wrong?

This is what i get
Jan 1, 2009 5:18 AM

Offline
Apr 2008
78
try this:

for ($j=1;$j<$i;$j++) {
if ($cnt = strstr($buffer[$j],$title)) { //strstr('string to be searched', 'string to search')
//if the specified string has been found do...
//str_replace('found string', 'replace with', 'replace it in')
//and save it in the variable $ncnt
$ncnt = str_replace($title, "", $cnt);
$end = strstr($ncnt, $titleend); //strstr('string to be searched', 'string to search')
//once again replace a part of the string and save the outcome in a new arrai
$cutter = str_replace($end,"",$ncnt);
If (strlen($cutter) > 6)
{
$titles[$t] = substr($cutter, 0, 6);
$titles[$t] .= "...";
}
else{
$titles[$t] = str_replace($end,"",$ncnt);
}
$t++;

}

}
Luck is the last dying wish of those who wanna believe that winning can happen by accident, sweat on the other hand is for those who know it's a choice, so decide now because destiny waits for no man.
Jan 1, 2009 5:26 AM

Offline
Jul 2007
2780
Its the same as before
Jan 1, 2009 5:32 AM

Offline
Oct 2008
390
Thanks for help everyone.

@cloud: You must replace several lines mentioned above not just add them at bottom.

This how final code should look like:

<?php
header("Content-Type: image/png");

//specify the url that shall be read
$url = "http://myanimelist.net/rss.php?type=rw&u=Ripaz";
//generate a readable file out of the specified url for our parser to read
$file = @fopen ("$url","r");
//starting and ending strings needed to get the valuable information out of the file
//do not modify this unless you know what you are doing
$title = "<title>";
$ptw = "<description>Plan to Watch -";
$watching = "<description>Watching -";
$completed = "<description>Completed -";
$onhold = "<description>On-Hold -";
$dropped = "<description>Dropped -";
$titleend = "</title>";
$descend ="</description>";
//set variables
$t = 0;
$z = 0;

//rss-parser(Anime-Titles)
if (trim($file) == "") {
echo "Service out of order"; //if we can't create a file MAL is supposed to be down
} else {
$i=0;
//this while-loop will run until the end of the file and read it line per line
//every single read line will be save in an array (in this case $buffer[$i]
while (!feof($file)) {
//1024 bytes per line will be read until the end of file has been reached
//every single line will be saved in the array $buffer
//example: line 1 would be saved in $buffer[0]; line 2 would be saved in $buffer[1] and so on
$buffer[$i] = fgets($file,1024);
$i++;
}
fclose($file);//close the file
}

//now we have to prepare the information we cached in the $buffer array earlier
//for this we are going to use a for-loop
//this for-loop just extracts the anime_title information
for ($j=1;$j<$i;$j++) {
if ($cnt = strstr($buffer[$j],$title)) { //strstr('string to be searched', 'string to search')
//if the specified string has been found do...
//str_replace('found string', 'replace with', 'replace it in')
//and save it in the variable $ncnt
$ncnt = str_replace($title, "", $cnt);
$end = strstr($ncnt, $titleend); //strstr('string to be searched', 'string to search')
//once again replace a part of the string and save the outcome in a new arrai
$cutter = str_replace($end,"",$ncnt);
If (strlen($cutter) > 32)
{
$titles[$t] = substr($cutter, 0, 32);
$titles[$t] .= "...";
}
else{
$titles[$t] = str_replace($end,"",$ncnt);
}
$t++;
}
}


//this for-loop just extracts the anime_episode information
for ($j=1;$j<$i;$j++) { //episodes
if ($cnt = strstr($buffer[$j],$ptw)) {
$status[$z] = "plan to watch";
$z++;
}
if ($cnt = strstr($buffer[$j],$completed)) {
$status[$z] = "completed";
$z++;
}
if ($cnt = strstr($buffer[$j],$onhold)) {
$status[$z] = "on hold";
$z++;
}
if ($cnt = strstr($buffer[$j],$dropped)) {
$status[$z] = "dropped";
$z++;
}
if ($cnt = strstr($buffer[$j],$watching)) {
$ncnt = str_replace($watching, "", $cnt);
$end2 = strstr($ncnt, $descend);
$status[$z] = str_replace($end2,"",$ncnt);
$z++;
}
}

//generate the image
$blub = ImageCreateFromPng("blueye.png");
$font = 'hero';
//imagecolorexact(image, red(between 0 and 255), green, blue)
//imagecolorexact($blub,0,0,0) = black font | imagecolorexact($blub,255,255,255) = white font
$colour = imagecolorexact($blub,210,201,194);
//imagefttext(image, font size, angle, x-pos(relative to the image in px), y-pos, font color, fontfile, text output)
imagefttext($blub,12,0,195,95,$colour,$font,$titles[0]);
imagefttext($blub,9,0,200,112,$colour,$font,$status[0]);
imagepng ($blub); //we want our final image to be in the png format
//imagepng ($blub, "sig.png") //imagepng (image, save as)
//imagedestroy ($sig);
?>
RipazJan 1, 2009 5:36 AM
Jan 1, 2009 6:06 AM

Offline
Jul 2007
2780
K thanks it works fine now :)
Jan 2, 2009 10:24 AM

Offline
Sep 2008
630
been trying to figure out whats wrong with it for awhile, but i cant get the 'sig_creator.php' to load on the website. keep getting 'not found'
any ideas on what's the problem?

using 000webhost
signature folder is 777 and the 'sig_creator.php' & 'sig.png' are both 755.
also in the signature folder is the 'Capture_it.tff' and 'dark_sig.png'


edit: got it. man why do i always figure it out AFTER posting about it for most of the things i do x-x.

new edit:
ok, im starting to get the concept of it now. just wanted to know if theres a way to change the font style so that lowercase will be small caps (like my current signature title)
atruong18Jan 2, 2009 11:22 AM
Jan 3, 2009 7:49 AM

Offline
Dec 2007
218
Edited the code so it can change pictures according to the update. Like, if you are watching CLANNAD, then an image related to it will be displayed, or If you are watching Special A then another picture will be displayed and so on.

If anyone is interested, here is the code.

I used what kuroshiroi gave to change the picture randomly.
if (strstr($titles[0], "Clannad"))
{
$num = rand(0,2);
switch($num)
{
case 0:
$src = imagecreatefrompng ('clannad1.png');
break;
case 1:
$src = imagecreatefrompng ('clannad2.png');
break;
case 2:
$src = imagecreatefrompng ('clannad3.png');
}
}elseif (strstr($titles[0], "Special A")){
$src = imagecreatefrompng ('sa.png');
}elseif (strstr($titles[0], "Pani Poni Dash!")){
$src = imagecreatefrompng ('ppd.png');
}else{ $src = imagecreatefrompng ('default.png');
}

It will first search for CLANNAD in the title and if it was found it will create random number between 0 and 2, according to that number an image will be displayed.

If CLANNAD was not found it will move to the second condition (after elseif) and search for Special A which will display another picture. Again, if the condition was not met it will move to the next condition. If none of the conditions were met then it will move to else (last line) and will display another image (this can be the default image). I hope I was able to explain it properly. If you think anything is wrong with it then please point it out :)
Jan 3, 2009 10:29 AM

Offline
Oct 2008
390
Might be usefull when you are watching anime that is currently aring, other than that there is no point going trough to much trouble.
Jan 3, 2009 5:16 PM

Offline
Feb 2008
4295
Fara7 said:
Other than the fact that I don't think your Poni Poni Dash! check is working, why didn't you just use another switch :) It works the same way as all those if else conditions.
Jan 3, 2009 7:33 PM

Offline
Dec 2007
218
If you think it is not working because of the current signature I am using then it is because the code I wrote is not associated with my signature here on MAL :)


It worked for me :)
Jan 3, 2009 8:42 PM

Offline
Feb 2008
4295
Now that's just cruel, tricking me like that... :)
Jan 4, 2009 2:05 AM

Offline
Oct 2008
390
Is there any opacity code for font?
Jan 4, 2009 12:01 PM

Offline
Feb 2008
5089
atruong18 said:
been trying to figure out whats wrong with it for awhile, but i cant get the 'sig_creator.php' to load on the website. keep getting 'not found'
any ideas on what's the problem?

using 000webhost
signature folder is 777 and the 'sig_creator.php' & 'sig.png' are both 755.
also in the signature folder is the 'Capture_it.tff' and 'dark_sig.png'

Im having this problem, kind of. ;___;

Might I have some files in the wrong folder?

I have both my ".png" files, my font file, and my "sig_creator.png" file in the Signature folder. Is that wrong? The host Im using is Awardspace.com

Any help is appreciated.

http://cielodesign.awardspace.com/Signature/sig_creator.php

T_T

My script:

Jan 4, 2009 12:04 PM

Offline
Sep 2008
630
Drybananna said:
atruong18 said:
been trying to figure out whats wrong with it for awhile, but i cant get the 'sig_creator.php' to load on the website. keep getting 'not found'
any ideas on what's the problem?

using 000webhost
signature folder is 777 and the 'sig_creator.php' & 'sig.png' are both 755.
also in the signature folder is the 'Capture_it.tff' and 'dark_sig.png'

Im having this problem. ;___;

Might I have some files in the wrong folder?

I have both my ".png" files, my font file, and my "sig_creator.png" file in the Signature folder. Is that wrong? The host Im using is Awardspace.com

Any help is appreciated.

http://cielodesign.awardspace.com/Signature/sig_creator.php

T_T



first of all, did you set the signature folder as 777 and the php and png files to 755?

as in how i solved my problem, i (after quadruple checking the above, lol) move the folder into public, and it magically worked.
Jan 4, 2009 12:07 PM

Offline
Feb 2008
5089
When I put it to 777, it gives me this error: Error 500: Script Execution Failure

So I did what the above posts told me to do when getting that error and set it to 755. :<
Jan 4, 2009 12:11 PM

Offline
Sep 2008
630
Drybananna said:
When I put it to 777, it gives me this error: Error 500: Script Execution Failure

So I did what the above posts told me to do when getting that error and set it to 755. :<


hmm, im not sure about this. double check to see if you put all the things in the right places?
im only an amateur in coding myself. but i do recognize terms so it helps alittle (arrays...*shudders*)
Jan 4, 2009 12:21 PM

Offline
Feb 2008
5089
Gracias for trying to help. <3

Bah, been messing around with it and still get errors.

New SCRIPTYY Im using:


Could it be the hosting site?
Jan 4, 2009 12:26 PM

Offline
Sep 2008
630
did you try it without your own added customizing? if his default didnt work, then its a problem with the inputting to the site.
if his default works, then its your change thats causing the problem.

try his default first to see if its your host's problem.
Jan 4, 2009 12:39 PM

Offline
Feb 2008
5089
His png files won't even upload in my ftp. =/ Im trying a new host now, though, so I hope that works. :D
Jan 4, 2009 12:40 PM

Offline
Sep 2008
630
Drybananna said:
His png files won't even upload in my ftp. =/ Im trying a new host now, though, so I hope that works. :D


might be limitations in that site i guess, try 000webhost?
Jan 4, 2009 2:05 PM

Offline
Feb 2008
5089
New host seemed to do the trick + big thanks to Scud for helping me out. <3

Now, I have one last question:


That is what I came out with, but I want that black edges to go away so it will be transparent. In other words, it was suppose to be "ovular" not square. Sorry if that made no sense.

Gracias ahead of time. :D
Jan 4, 2009 2:11 PM

Offline
Sep 2008
630
Drybananna said:
New host seemed to do the trick + big thanks to Scud for helping me out. <3

Now, I have one last question:


That is what I came out with, but I want that black edges to go away so it will be transparent. In other words, it was suppose to be "ovular" not square. Sorry if that made no sense.

Gracias ahead of time. :D


there was a thread where someone posted that code up. forgot which, look for it yourself, or wait until i find it and edit this message
Jan 4, 2009 2:12 PM

Offline
Feb 2008
5089
Been looking for it, thought there might be. Good to know it being confirmed that there actually is. Haven't found it yet, but I'll keep searching, you don't have to look if you don't want. Thanks for all the help. ♥
Pages (4) « 1 [2] 3 4 »

More topics from this board

» MAL Analog Horror

Wendy-- - Yesterday

10 by Malakira »»
2 hours ago

» MyAnimeList x Honeyfeed Writing Contest 2025 Submission

Avarion - 3 hours ago

0 by Avarion »»
3 hours ago

» New Clashing Feelings volume after a decade

Shiratori-san - Yesterday

2 by Shiratori-san »»
4 hours ago

» Vladimir Volfovich Zhirinovsky's MAL Diary of Kawai Memories

V_V_Zhirinovsky - Today

1 by V_V_Zhirinovsky »»
Today, 1:00 AM

» New Android App – Shimeji Mascot Screen Pets

shimejimascot - Sep 26

8 by hacker09 »»
Sep 26, 10:03 PM
It’s time to ditch the text file.
Keep track of your anime easily by creating your own list.
Sign Up Login