Forum Settings
Forums

saka's minimal signature script (with merged anime/manga feeds)

New
Reply Disabled for Non-Club Members
Pages (9) « 1 [2] 3 4 » ... Last »
Jul 17, 2009 7:18 AM

Offline
May 2008
4052
fixed the paren...

not sure about the cron problem. You can check your error log for signs of problems, but if your script runs properly when you load the url, it should be the same when cron runs it.

V3gas, filtering out those plan to watch statuses might be tricky, since you need to maintain the other arrays with it. I guess you'd need to make a for loop and have it go through and remove them, copying over each of the other arrays to make sure the array index still matches.... I'll write something for you later when I get back from work.

I am a banana.
Jul 19, 2009 6:10 AM

Offline
Aug 2008
175
saka said:
fixed the paren...

not sure about the cron problem. You can check your error log for signs of problems, but if your script runs properly when you load the url, it should be the same when cron runs it.

V3gas, filtering out those plan to watch statuses might be tricky, since you need to maintain the other arrays with it. I guess you'd need to make a for loop and have it go through and remove them, copying over each of the other arrays to make sure the array index still matches.... I'll write something for you later when I get back from work.

Oh, sounds tricky. But awesome, thanks in advance!

EDIT: Stupid question, I figured it out.

But anyway, saka; awesome script, thanks for putting so much time into it, and, of course, sharing it!
V3gasJul 19, 2009 1:12 PM
Jul 29, 2009 11:33 PM

Offline
May 2008
4052
Xinil changed the feeds slightly ("Re-Watching" changed to "Rewatching"), so I've updated both versions of the script to fix those statuses.

Older versions might end up displaying Rereading manga as Rewatching since they won't get replaced properly, and the status checks on the title formatting lines may fail causing numbers to not appear (with my default code). I encourage people to do a global replace of "Re-Watching" to "Rewatching", which is only in one place in the anime version, and two in the animanga version.

I am a banana.
Jul 31, 2009 11:51 AM

Offline
Feb 2009
7
my cron problem got solved in case anyone else has that problem. It turns out the cron was starting in my home directory (instead of where the php script was) and trying to find the cache folder from there, which failed so it did nothing

so I added this to the top of the php script and now it works perfectly
chdir('public_html/myanimelist/');

just point it to where your php script is and the rest works like normal
Jul 31, 2009 12:03 PM

Offline
May 2008
4052
hmmm interesting..... which of 000webhosts servers are you running on (it should say on the right side after you login to your panel). This is a php environment issue.... as usually php should still run with its current directory as the script location.

I wonder if maybe its running as php 4 instead of php 5+....

I am a banana.
Jul 31, 2009 10:06 PM

Offline
Feb 2009
7
saka said:
hmmm interesting..... which of 000webhosts servers are you running on (it should say on the right side after you login to your panel). This is a php environment issue.... as usually php should still run with its current directory as the script location.

I wonder if maybe its running as php 4 instead of php 5+....


its says its running on server33.000webhost.com
php 5.2
Aug 16, 2009 4:33 PM

Offline
Aug 2009
353
Total php noob here... Can someone tell me how to change "watching @ y/x" to something like "y of x episodes"?
Aug 16, 2009 5:01 PM

Offline
May 2008
4052
FinestX said:
Total php noob here... Can someone tell me how to change "watching @ y/x" to something like "y of x episodes"?


just look for this bit around line 50:
$status[$i] = "$status[$i] @ $current[$i]/$totals[$i]";

...and change it to this:
$status[$i] = "$status[$i] at $current[$i] of $totals[$i] episodes";

or if you're using the merged anime/manga feed (where it might be chapters or episodes depending what updated most recently), then use the $units[] array on the similar line around line 63:
$status[$i] = "$status[$i] at $current[$i] of $totals[$i] $units[$i]";

I am a banana.
Aug 21, 2009 12:39 AM

Offline
Aug 2009
353
saka said:
FinestX said:
Total php noob here... Can someone tell me how to change "watching @ y/x" to something like "y of x episodes"?


just look for this bit around line 50:
$status[$i] = "$status[$i] @ $current[$i]/$totals[$i]";

...and change it to this:
$status[$i] = "$status[$i] at $current[$i] of $totals[$i] episodes";

or if you're using the merged anime/manga feed (where it might be chapters or episodes depending what updated most recently), then use the $units[] array on the similar line around line 63:
$status[$i] = "$status[$i] at $current[$i] of $totals[$i] $units[$i]";

Alright, thanks a lot! XD

Edit: I noticed some sigs had some kind of progress bar or something like that? Can we actually make something like that? If so can somebody teach me how to?
Aug 21, 2009 10:09 AM

Offline
May 2008
4052
once you figure out how to draw rectangles in gd, it's not too difficult to divide the current eps by the total. That's pretty much all you need. Here's the code for a function to draw progress bars, modified from one I wrote for someone else's signature. There may be bugs, since I didn't test with this script... but it should work.




...just copy that code above into the bottom of the script before the ?> (or include it from an external file if you don't like looking at all the function code). Now you can make calls to it like this:

drawProgBar(0,25,25,"990000","550000");


That will use your first update (index 0) to draw a progress bar at 25,25 with those colors. You can just substitute the string "trans" for either color and it will not draw that half of the progress bar. You can optionally specify the width and height of the progress bar as well as an overall transparency by using those extra arguments:

drawProgBar(0,25,25,"990000","550000",200,3,25);


That example draws the same progress bar at 25,25 but now it will be 200px long and 3 pixels high, and will slightly fade into the background (25% transparent, similar to having 75% opacity on a photoshop layer). In this function 0 is fully opaque and 99 is almost completely transparent.

I have another version that can draw progress bars at an angle (by using some trigonometry), but it looks ugly unless you upscale the image first. I might make that one easier to use and release it with my script code later.

I am a banana.
Aug 22, 2009 4:54 PM

Offline
Aug 2009
353
Got it... I think. :P
Aug 25, 2009 10:06 AM

Offline
Aug 2009
403
having a problem. Your script works GREAT and it is much easier to use. However, I have a problem with how the text is displaying itself on my signature. I know its not a problem with the actual scripting because I copied the same parameters I used before. Here they are


Anything that you can do to help me get it working would be greatly appreciated. Thanks.
Caprica6Aug 25, 2009 10:11 AM
Aug 25, 2009 11:06 AM

Offline
Jul 2008
97
you don't have to post it all over MAL....
Aug 31, 2009 7:55 PM

Offline
Apr 2007
1964
Little questions:
About the "PARSING THE RSS FEED AND EXTRACTING DATA" section in the anime only script... what does it do? Cause I'm not sure I understand what I can change and what not to change... >.<;;

& about the cache, do I need the "sig.png" file in the cache folder as well as the signature folder?
crystal_yuyAug 31, 2009 10:18 PM




Aug 31, 2009 10:30 PM

Offline
May 2008
4052
crystal_yuy said:
Little questions:
About the "PARSING THE RSS FEED AND EXTRACTING DATA" section in the script... what does it do? Cause I'm not sure I understand what I can change and what not to change... >.<;;

It basically just converts the RSS feed into variables you can use. You shouldn't have to change anything there, except perhaps under the "// FORMAT THE TITLE VALUES" and "// FORMAT THE STATUS VALUES" comments if you want to change the strings into something other than the defaults.

crystal_yuy said:
& about the cache, do I need the "sig.png" file in the cache folder as well as the signature folder?

Basically just point $cachedpath to wherever you want it saved.

That $cachedpath can be any location that's writable by the webserver. The script saves an image copy of your signature there every time it updates. You can either make a blank sig.png file in the same directory and make that image writable, or make an empty cache directory and make the directory writable so it makes its own... both ways work.

Luckily on justhost which is huyyy's host, you don't need to change anything to make it writable.... so just put any file path you want into $cachedpath and it'll work fine.

I am a banana.
Aug 31, 2009 10:50 PM

Offline
Apr 2007
1964
@ saka: I see.. Thanks ^^




Aug 31, 2009 11:31 PM
Offline
Feb 2009
1637
Great job saka :3
But I hope you won't mind me asking a few things xD

1. What exactly is the major difference between the first script you provided and the second? xD Cause I can't seem to tell. I'm using the anime/manga merged.

2. Foreground Image doesn't seem to work for me (and kyrori). Whenever I post a foreground image in that line where I'm supposed to, the foreground image won't show up. It'll just remain as the background image.

3. How do you get rid of "Completed" or "Plan to watch"? like, if you only want the episodes to show.

Sorry for all the questions. xD
Aug 31, 2009 11:48 PM

Offline
May 2008
4052
CharisMagic said:
1. What exactly is the major difference between the first script you provided and the second? xD Cause I can't seem to tell. I'm using the anime/manga merged.

the first script downloads only one feed, and it's designed for anime only, so it doesn't distinguish between chapters/episodes. the second script downloads both the recently watched anime RSS feed and the recently read manga RSS feed and then merges them together into one super update feed -- i'm pretty sure it's the only script that merges them this way although other scripts let you grab one entry from each.

CharisMagic said:
2. Foreground Image doesn't seem to work for me (and kyrori). Whenever I post a foreground image in that line where I'm supposed to, the foreground image won't show up. It'll just remain as the background image.

I tested it before and it worked fine for me... just put the image name in the overlay_image() function and remove the // in front so it isn't commented out.

The line is after all the text is drawn with imagettftext, so it should be overlaid on top of that.

CharisMagic said:
3. How do you get rid of "Completed" or "Plan to watch"? like, if you only want the episodes to show.

Just find this block:
// FORMAT THE STATUS VALUES - you can change the format as you like
if ( in_array($status[$i], array("Watching", "Rewatching", "Reading", "Rereading") ) ) {
$status[$i] = "$status[$i] @ $current[$i]/$totals[$i]";
} else { // "Completed, "Plan to Watch", "Dropped", or "On Hold"
$status[$i] = "$status[$i]"; // doesn't really do anything, but feel free to modify
}

...and remove the $status[$i] parts from the right hand sides of the equal signs.

That code block says basically... "if i'm watching it, print the status and the episode numbers... otherwise just print completed/dropped/on hold without any episode number."

If you just want it to print only the episode numbers every time, you could replace that whole block with just:
// FORMAT THE STATUS VALUES - you can change the format as you like
$status[$i] = "$current[$i]/$totals[$i]";


I just added the if statement as an example.

I am a banana.
Sep 1, 2009 5:22 PM

Offline
Apr 2007
1964
I have two more little question..

1. What do I change, if it's possible, if I want it to say something like "watching 10/10" instead of "Completed"?

2. Is it possible to set it so it only update episode? Not sure how to say this...
Like, the one I currently have, with slicing part and all, it's only update when I update an episode, the title I add as "Plan to Watch" or "Dropped" aren't add.. Can I do that with the script one as well?




Sep 1, 2009 6:58 PM

Offline
May 2008
4052
crystal_yuy said:
1. What do I change, if it's possible, if I want it to say something like "watching 10/10" instead of "Completed"?

In the rss update feed, completed series are marked with a "Completed" so you'd have to manually replace completed with watching... something like this:

// FORMAT THE STATUS VALUES - you can change the format as you like
if ( in_array($status[$i], array("Watching", "Rewatching", "Reading", "Rereading") ) ) {
$status[$i] = "$status[$i] $current[$i]/$totals[$i]";
} else if ($status[$i] == "Completed") {
$status[$i] = "watching $current[$i]/$totals[$i]";

} else { // "Plan to Watch", "Dropped", or "On Hold"
$status[$i] = "$status[$i]"; // doesn't really do anything, but feel free to modify
}

It's kinda similar to question 3 in CharisMagic's question above... just use if statements and rewrite the status however you wish.


crystal_yuy said:
2. Is it possible to set it so it only update episode? Not sure how to say this...
Like, the one I currently have, with slicing part and all, it's only update when I update an episode, the title I add as "Plan to Watch" or "Dropped" aren't add.. Can I do that with the script one as well?

It should be possible to remove the "Plan to Watch"/"Dropped"/"On Hold" status changes... I suppose the only way to do it would be to just loop through looking for those statuses, and if you find one remove the elements from all the parsed arrays so those other arrays would still match. (so if you find "Plan to Watch" in $status[5], go through and remove $titles[5], $current[5], $total[5], etc)... I haven't tested this, but something like this after the values are parsed and right before that big block in the previous question.

foreach ($status as $k => $s) {
if ($s == "Plan to Watch" or $s == "Dropped" or $s == "On Hold" ) {
unset( $titles[$k], $status[$k], $current[$k], $totals[$k]);
}
}
// and we need to fix the array indices for all the arrays because we removed items
$titles = array_values($titles);
$status = array_values($status);
$current= array_values($current);
$totals = array_values($totals);

^ this works only for the normal version.... for the merged animanga one, you'll also need to take care of $units[] and $timestamps[].

Keep in mind that the feed only contains your last 15 updates.... if all of those updates have one of those ignored statuses, you might end up with a blank sig... unlikely but careful not to add more than a dozen new series to 'plan to watch' all in a row.



small edit: the & i had was *not* important in the foreach
sakaSep 1, 2009 7:07 PM

I am a banana.
Sep 1, 2009 9:41 PM
Offline
Feb 2009
1637
@ saka: thanks so much for the explanation ^__^

For the foreground image thing, turns out it didn't work cause I didn't remove the //
xD So simple.
Sep 2, 2009 3:39 PM

Offline
Apr 2007
1964
@ saka: Thank you for the help ^-^




Sep 2, 2009 4:36 PM

Offline
May 2008
4052
I highly recommend using a text editor that has syntax highlighting when you're working on stuff like this.... Notepad++ is a good one to associate with your *.php files...

http://notepad-plus.sourceforge.net/

Then it would have been more obvious what was a comment and what wasn't. ;)

I am a banana.
Sep 6, 2009 6:02 PM

Offline
Mar 2009
817
saka said:
I highly recommend using a text editor that has syntax highlighting when you're working on stuff like this.... Notepad++ is a good one to associate with your *.php files...

http://notepad-plus.sourceforge.net/

Then it would have been more obvious what was a comment and what wasn't. ;)


Whoa cool. I was thinking about how convenient a text editor like this would be for php. The editors that come with compilers I've used in the past do this automatically for me, but I was always too lazy to look for one for when I program in php.

Edit: I've tried it out and I love it! :)
perspectiveSep 6, 2009 6:14 PM
Sep 7, 2009 5:00 PM

Offline
May 2009
429
Just started meddling with php scripts for the first time. Great to have this script which has info about most lines, so major props to you, saka.

I've got a question, though, and i apologise if it's silly or obvious.

I'm trying to cache the .png file created by sig.php, or whatever it is that creates it, but it doesn't seem to appear in the directory that i've created in the signature folder.

I've placed the cache directory within the signature directory, so the destination would probably look like : "signature/cache/sig.png"

The script is in the signature directory, along with all the other required files.

The (i think) relevant parts of the script go as follows:



I don't think i've even changed any of it, so it's probably me having screwed up somewhere.


Thanks again.

Edit: Yep, my idiocy got the better of your great script. Just forgot to change the access for the cache to 777.
krjmiismSep 7, 2009 5:26 PM
Sep 7, 2009 5:18 PM

Offline
May 2008
4052
Nitre said:
Just forgot to change the access for the cache to 777.

yeah, the file permissions get a lot of people....and most people don't understand how the caching works period. maybe I should add some code to check if the location is writable and error out.

I am a banana.
Sep 7, 2009 5:25 PM

Offline
May 2009
429
If it's not too tough a piece of code to write, i'm sure fewer people using this would be confused about why things aren't working, since quite a few things seem to hinge on permissions being correct.
Sep 7, 2009 6:14 PM

Offline
May 2008
4052
well, not really.... currently it works as cache-optional, so if it fails to write the image to cache it will generate the image at every refresh. It's still bad not to cache it though, so it wouldn't hurt to give an extra nudge to people who don't read the comments carefully. I also don't want to alienate people about it, since some servers don't even require a permissions change for the cache to work.
sakaSep 8, 2009 6:18 PM

I am a banana.
Sep 8, 2009 12:02 PM

Offline
Aug 2008
175
@saka: I tried what you posted earlier, but I can't get it to work. I'm using the merged script. Could you just post the piece of code I need, and where to put it in? 'Cause I really don't know php. I asked you on the previous page, about two months ago, and you said you'd work something out later.

I'm sorry if it seems rude.
Sep 8, 2009 7:24 PM

Offline
May 2008
4052
Here's my code modified to ignore the "Plan to Watch/On-Hold/Dropped" statuses for both anime and manga. I added only lines 50-68.

http://pastebin.com/f331d9516

if you uncomment the debug lines you can test that the statuses are properly removed:


this cannot be combined with the 'index 15' hack to get first manga entry, though, since removing the entries would change that array key... if you need that at the same time then it requires much more tweaking. Let me know.
sakaSep 8, 2009 7:31 PM

I am a banana.
Sep 9, 2009 1:20 PM

Offline
Aug 2008
175
saka said:
Here's my code modified to ignore the "Plan to Watch/On-Hold/Dropped" statuses for both anime and manga. I added only lines 50-68.

http://pastebin.com/f331d9516

if you uncomment the debug lines you can test that the statuses are properly removed:


this cannot be combined with the 'index 15' hack to get first manga entry, though, since removing the entries would change that array key... if you need that at the same time then it requires much more tweaking. Let me know.

Oh, awesome! Thanks a bunch!!
V3gasSep 9, 2009 1:25 PM
Sep 10, 2009 7:05 AM

Offline
May 2009
429
I've set up 2 cronjobs which look like this:



which both have chmods of 755. The folder they're in is 777, and the folder into which the cached files go is the same.

What might be the problem is that i'm unable to edit the chmods of the cached files. I get this error:



However, the sig doesn't seem to update properly unless i manually access the php script. Any ideas?
krjmiismSep 10, 2009 7:10 AM
Sep 10, 2009 9:26 AM

Offline
May 2008
4052
I recommend using your own ftp program instead of the online file manager that 000webhost provides, since it's buggy at times. I recommend FileZilla.

The web based one may be having problems if the cached image has become owned by apache (instead of your username), although that error is kind of unforgivable on their part for something that simple. Anyhow, you can fix this by choosing the "Fix File Permissions" icon toward the bottom of your control panel.

As to why your sig isn't updating from your cron job, you should check your error log for hints. An earlier user had a similar problem and had to manually fix php's environment using chdir() at the top of the script, although it works fine on other 000webhost servers so go figure.

Try putting this at the top of your script on its own line after the <?php:
chdir('public_html/signature');

I am a banana.
Sep 10, 2009 3:36 PM

Offline
May 2009
429
Sorted the problem with the access rights, my user wasn't set as the owner.

I tried putting chdir('public_html/signature'); at the top of the scripts, but when i tried to open the script it wouldn't run. I've reset the site, started from a clean slate and it still doesn't update from the cron jobs.

I don't seem to see an error log anywhere obvious on the site to check it?
Sep 10, 2009 4:21 PM

Offline
May 2008
4052
Actually I'm having trouble finding it too.... I guess 000webhost doesn't have an error log for free customers? ...ugh.

I'll try testing the php environment there and then check back.

Edit: okay so when you run it using the php command line (as cron does) you get '/home/username' as your current directory regardless of whether the script is located there... so add this to the beginning of your script in place of the chdir above. This way it should work both through the browser and through command line php called from cron.

<?php

// try to correct environment path
@chdir(realpath(dirname($argv[0])));

...


I'll add this to the script since it should work on all sytems...
sakaSep 10, 2009 5:29 PM

I am a banana.
Sep 10, 2009 5:52 PM

Offline
May 2009
429
Well, i put



at the top of the script.

I probably got the first line wrong somewhere since an error occurred unless i commented it out.

Something seems to have happened though, since the cached files weren't updating at all before, but it might have done something now. Since i've got 2, i'm going to wait a bit and see if the cronjob updates properly.

edit: I think it's been 10 mins, and the sig i'm using at the moment hasn't updated yet. Going to (probably futilely) redo the cron jobs.
krjmiismSep 10, 2009 6:17 PM
Sep 10, 2009 6:32 PM

Offline
May 2008
4052
It sometimes takes a few minutes for the new cron jobs to be activated. I'm testing this as well with the default sig code, and haven't seen mine update yet either. (edit: now it's updated normally, so cron works fine with the script, at least on the 000webhost server I'm using).

My cron job looks something like this:

sakaSep 10, 2009 6:41 PM

I am a banana.
Sep 10, 2009 6:43 PM

Offline
May 2009
429
Aaaaaah, if that one works, it must be because i didn't have public_html there, cos i was using this one:



from your post on page 1. Seems obvious now that it wouldn't work.

Trying the updated version now.
Sep 10, 2009 6:52 PM

Offline
May 2008
4052
If you don't have luck with that, or even if you do... you might want to look into alternative ways to do it.... there are free cron job services out on the web like http://www.onlinecronjobs.com/ or you could do what I usually do and use Mal Updater's php signature plugin to visit the url whenever you watch new anime (you don't need malu's info, just let it visit your url).


edit: I've also fixed the screenshot earlier in the thread, since it's misleading.
sakaSep 10, 2009 6:56 PM

I am a banana.
Sep 10, 2009 7:53 PM

Offline
May 2009
429
Ah, it finally works.

I was thinking of using the php plugin from MAL Updater, but for some reason it doesn't detect or update most of my stuff, although i've only used it a very small amount, but that's a problem to sort out on another day.

Thanks again for the help.
Sep 22, 2009 2:22 PM

Offline
Aug 2009
403
I wrote the progress bar script to work with saka's minimal script. Basically, I have adapted a class for all the functions that can be done. I can reflect(like sakas) as well as many other things. I just added progress bars. Here is the code.


This is how you use it.
First create a new text document, and paste this code. save it as progress.php

then at the top of your sig_creator do this:
require "progress.php";


Then To implement it, here is the first updates progress bar code.
drawProgBar($sigimage,$current[0],$totals[0],356,91,255,0,0,0,0,0,70,3,45);

To make it work for you all you do is change [0] to whatever update you want [1] [2] whatever. then after that you see a lot of numbers. Here is what they are.
356 = x position of the progress bar
91 = y position of the progress bar
255,0,0 = RGB values for the top bar
0,0,0 = RGB values for the background bar.
70 = width
3 = height
45 = transparency.

Have fun with this, and be creative, hope to see it used more on anyone that uses saka's minimal script!!!

(WILL NOT WORK WITH ANY OTHER SCRIPT WITHOUT MODIFICATION)
Sep 28, 2009 4:39 PM

Offline
May 2008
4052
I've made a significant update the the script on the first page. Particularly I've added two optional functions:
  • imagettftextalign(...) - this works identically to imagettftext() except that it allows you to center or right-align text in addition to the default left align. To use it, just change your imagettftext() calls to imagettftextalign() and add one of the following single characters to the end before the paren:
    'c' - center's the bottom line of the text to the x,y
    'r' - right aligns the text so the bottom right corner of the text is as close as possible to x,y
    Example: imagettftextalign($sigimage,14,0,250,36,$colour,$font,$titles[0],'c');

  • textlimitpx(...) - this function will take that string that you pass it, and return a shortened string (with '...'). This is different from the normal textlimit() in that you can shorten the string to exact pixel restrictions instead of guaging it by the width of individual letters in a string (which might vary since letters like 'l' are much shorter than characters like 'w'). In order to perfectly shorten it, you have to provide the path to your font and the size you plan to use to display it.
    Example: $titles[$i] = textlimitpx($titles[$i],200,'ariblk.ttf',14);
    ^ this would return a shortened string that, when printed with the font 'ariblk.ttf' at size 14 would be less than 200 pixels horizontally. Make sure you use the exact same font/size values when you actually output the text or it's useless!

I've also added a link to the creative commons license, since it felt most appropriate, and the script now outputs an error if check_cache() is run but the cache is not writable. You can still disable the cache for testing by putting // before the check_cache(...) line at the top.
sakaSep 29, 2009 12:37 AM

I am a banana.
Sep 29, 2009 8:59 PM
Offline
Feb 2009
1637
Great job saka :D

but um for some reason, i can't get cache to work >.<

i can't use 777 cause huyyy told me the server won't accept that.

for my other sigs, i cam just make a cache folder without changing it to 777 and it'll still work.
but for this new update, i can't get cache to work
Sep 29, 2009 9:01 PM

Offline
Jun 2007
1755
CharisMagic said:
Great job saka :D

but um for some reason, i can't get cache to work >.<

i can't use 777 cause huyyy told me the server won't accept that.

for my other sigs, i cam just make a cache folder without changing it to 777 and it'll still work.
but for this new update, i can't get cache to work
Same thing happened to me, I just commented out the 2 cache lines with // and uh... I think that's it. Try that.

And thanks saka~

?_? || Mo <3: squrrriles kidnapped her let's eat theree nuts || ♪♫♪
Sep 29, 2009 9:07 PM
Offline
Feb 2009
1637
cailoli said:
CharisMagic said:
Great job saka :D

but um for some reason, i can't get cache to work >.<

i can't use 777 cause huyyy told me the server won't accept that.

for my other sigs, i cam just make a cache folder without changing it to 777 and it'll still work.
but for this new update, i can't get cache to work
Same thing happened to me, I just commented out the 2 cache lines with // and uh... I think that's it. Try that.

And thanks saka~
yeah i'm doing that until i figure what's wrong lol
Sep 29, 2009 10:47 PM

Offline
May 2008
4052
huyyy uses justhost... which is one of the few hosts where there's no need to change the directory permissions. You should be able to upload it and it just works.

Just make an empty directory named cache on the sever and the script will make the image there as soon as you run it.


Edit: actually there seems to be some kind of problem with is_writable() on justhost... probably because of suPHP which is the reason you don't need to chmod. You can work around this by changing is_writable(...) to file_exists(...) near the bottom in the check_cache function. I'll do some more testing and patch it if I can find a better solution.

okay... figured it out..... is_writable returns false if the file doesn't exist, so it will work as long as you make a sig.png file in the cache directory (it can be anything, even a blank text file since the script will overwrite it). This is confusing so I've changed the code on the first page.

To patch your code just replace this line in check_cache() near the bottom:
if (!is_writable($cachedpath)) die("The cache is not writable; please change it to 777 permissions using FTP.\n$cachedpath = {$cachedpath}");
...with...
	if ( !( is_writable($cachedpath) or is_writable(dirname($cachedpath)) and !file_exists($cachedpath) ) )
die("The cache is not writable; please change it to 777 permissions using FTP.\n$cachedpath = {$cachedpath}");
sakaSep 29, 2009 11:53 PM

I am a banana.
Sep 30, 2009 5:24 AM

Offline
May 2009
429
Those functions will definitely be extremely useful.

Great stuff as usual.
Oct 4, 2009 2:56 PM

Offline
Feb 2008
5089
This align stuff is confusing. Very good update, but confusing..

I change my x, y things and it doesn't move the right way..
Also, my border won't stay with my base text. :(

Im so lost on how to work this align thing.

Oct 4, 2009 9:06 PM

Offline
May 2008
4052
Drybananna said:
This align stuff is confusing. Very good update, but confusing..

I change my x, y things and it doesn't move the right way..
Also, my border won't stay with my base text. :(


If you want to use align with your imagettfborder() function, replace all the calls to imagettftext() inside it with imagettftextalign() and pass the extra align argument. I've modified the imagettfborder() function you added.... try this code and see if it works:
http://codepad.org/tFReBSBx

I'm not sure what problem you're having with the coordinates, but the x,y coordinates are oriented such that the top left of the image is 0,0, and increases the further right and down you go. This is a php convention.... as for aligning, when left aligned, the coordinates are the bottom left corner of the text. When centered, the coordinates are the location for the bottom center of the text. For right, it's the bottom right corner of the text. If you're also changing angle, it will rotate clockwise about those points.

Maybe the text just isn't moving when you update? While you're testing you will want to change the check_cache(10); line to //check_cache(10); or it will only update once every ten minutes. Remove the slashes to re-enabled the cache once you have tweaked everything to your liking.

I am a banana.
Oct 6, 2009 3:44 AM

Offline
Nov 2008
103
So I'm thinking of switching to this script, but before that, I need to know what part does what, because as of now, I can barely make sense out of it.
Reply Disabled for Non-Club Members
Pages (9) « 1 [2] 3 4 » ... Last »

More topics from this board

» Scripted Signature Showcase

KHobbits - Jul 9, 2008

23 by KHobbits »»
Oct 21, 2014 6:42 PM

» MAL Signature Designer

Apocist - Mar 11, 2014

10 by Apocist »»
Aug 6, 2014 3:01 PM

» iSignature

i906 - Dec 11, 2009

9 by USKurosaki »»
Apr 10, 2013 8:40 PM

» Animated Signatures

koleare - Jan 3, 2013

1 by Rezurrekt »»
Jan 10, 2013 4:13 PM

» List of Free PHP Hosts that meet script requirements

saka - Jun 8, 2010

31 by saka »»
Oct 26, 2012 2:58 AM
It’s time to ditch the text file.
Keep track of your anime easily by creating your own list.
Sign Up Login