|
|
Suho1004
Maniac (V) Inmate
From: Seoul, Korea Insane since: Apr 2002
|
posted 05-20-2003 03:57
An inmate recently asked me what script I used to rotate my fortune cookie sig. I believe I gave a rather long-winded reply, mostly expounding on the joys of PHP and the GD image library, possibly throwing in a few pointers that might have been vaguely useful, but most likely not answering his question and boring him to death at the same time.
I did mention that it would be fairly easy to write a sig rotator script in PHP, but that I didn't have the time to do it at the moment. Last evening, though, I finished the third of four major projects for me this month, and I gave myself the rest of the evening off. My wife and I went out to a nice place called Pho Hoa for some Vietnamese noodles (a bit different from the Thai noodles I love, but still quite tasty). Then we had some tiramisu for dessert at a nearby bakery.
I know what you're thinking: "For crying out loud, Suho, get to the point!"
Ah, yes, the point. The point is that after we got home I sat down at my computer, did a bit of research, and then pounded out a simple PHP sig rotator script. This is the script in action:
(IE users may have to do a hard refresh (CTRL-F5) to see a new sig--at least I do. I think it has something to do with my cache.)
This script can be found lying around my cell--feel free to walk in and make a copy. I've also updated the original sig rotator FAQ with this information.
I know that mr.maX has a number of scripts available, but they require an e-mail, and mr.maX hasn't been seen around these parts in a while (at least not by me). So I figured a simple script that we could point people directly to wouldn't be a bad idea. Hope everyone has fun with it.
www.liminality.org
|
Emperor
Maniac (V) Mad Scientist with Finglongers
From: Cell 53, East Wing Insane since: Jul 2001
|
posted 05-20-2003 04:06
Suho1004: Thanks a lot for that - great stuff
___________________
Emps
FAQs: Emperor
|
DL-44
Maniac (V) Inmate
From: under the bed Insane since: Feb 2000
|
posted 05-20-2003 04:44
|
Moon Shadow
Paranoid (IV) Inmate
From: Rouen, France Insane since: Jan 2003
|
posted 05-20-2003 09:34
|
mahjqa
Maniac (V) Mad Scientist
From: The Demented Side of the Fence Insane since: Aug 2000
|
posted 05-20-2003 10:07
Yay! it worked! Thanks a bunch, Suho!
|
Suho1004
Maniac (V) Inmate
From: Seoul, Korea Insane since: Apr 2002
|
posted 05-20-2003 12:24
I'm glad the sig rotator is already being put to good use.
MS: I never actually considered that when I was writing the script, but it is a good question. I'm glad you were able to find the answer, but perhaps some supplementary explanation may help clear things up. The "fopen" function opens the file up (for read-only, and as a binary file, which is what the "rb" is for). The next few lines send the correct mime type to the browser, followed by the image information itself. To the browser, the file is an image, but it still has the php extension. Most preventative measures against external image linking rely on file extensions, not mime types, so this script is not something they would catch.
This script was never intended as a high-tech replacement for the usual tricks to get around no external linking policies. Obviously I can't control what people do with the script--it's out of my hands now anyway--but I hope that it will be used responsibly.
Eh... there's was really no way I could say that without sounding like a jerk. Apologies.
mahjqa: Don't mention it. I can't think of a better way to use the script than to rotate your sigs.
|
Taobaybee
Maniac (V) Inmate
From: The Pool Of Life Insane since: Feb 2003
|
posted 05-20-2003 15:44
Suho1004, thanks heaps, your a darlin'. I haven't applied it yet but I am on the case. Now that does give me more reason to make some more sigs,,,TY
Also, my theory, on the benifits to humanity from eating Tiramisu, are further enhanced by your example.
(later) Noooooo, outside blinkin, stinkin,.,.,have to wait for a better host server
[edit] my server is down
[This message has been edited by Taobaybee (edited 05-22-2003).]
|
Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers
From: Germany Insane since: Sep 2001
|
posted 05-20-2003 21:26
if you can find a host that allows php, but no outside linking, lucky you.
Apart from that, a nice script, master suho!
Now, go refactor it into nice little reusable functions. *g*
|
EzRa-D
Paranoid (IV) Inmate
From: Insane since: Dec 2002
|
posted 05-20-2003 22:51
THank you Master Suho!
errr testing...
yay! it works!
[This message has been edited by EzRa-D (edited 05-20-2003).]
|
Suho1004
Maniac (V) Inmate
From: Seoul, Korea Insane since: Apr 2002
|
posted 05-21-2003 01:30
TP: This was just a quick script designed to do a specific job. If you want reusable little functions, you go make them!
|
hellfireclanx
Bipolar (III) Inmate
From: Insane since: Mar 2003
|
posted 05-21-2003 03:52
hey
i used to use a rotater with a script similar to the you posted
the problem i was having was that some sites do not accept .php as images.
i found something like this on another forum it was originally meant for avatars
a copy can be found at http://www.zefhemel.com/avatars/avatarmanager.zip
it is pretty self explanitory, just fill in the desired pass then goto the link where you have uploaded it and type in the password. then you can upload images and it will automatically rotate it for you, all you have to do is link to the .jpg or to the .php
this program can be used for both sigs and avatars. one problem is that it will only accept the tag .gif, but the image itself doesn't have to be in .gif format. to upload a .jpg file, simply copy your file and replace the .jpg tag with .gif.
[This message has been edited by hellfireclanx (edited 05-21-2003).]
|
docilebob
Maniac (V) Mad Scientist
From: buttcrack of the midwest Insane since: Oct 2000
|
posted 05-21-2003 06:45
Good one, Master Suho.
The sigs are in motion.
|
Suho1004
Maniac (V) Inmate
From: Seoul, Korea Insane since: Apr 2002
|
posted 05-21-2003 16:51
*sigh*
OK, TP, you win. You knew I wouldn't be able to just sit there and do nothing, didn't you. The FAQ has been updated with version two--the "functional" version. Any more tips on better coding practices are welcome.
hellfire: That may be true, but I designed this script for use at the Asylum, where the issue you mentioned shouldn't be a problem. Still, the information might be useful for others outside of the Asylum. Thanks for the info.
db: Keep 'em rollin'...
By the way, I wil most likely not be posting again for a week. I have a presentation to give at an academic society on Saturday (not to mention interpretation duties) and a presentation for one of my classes next Wednesday. So I'm going to be a tad busy. Have fun with the script while I'm gone.
|
Dufty
Paranoid (IV) Inmate
From: Where I'm from isn't where I'm at! Insane since: Jun 2002
|
posted 05-22-2003 16:38
*Crosses everything*
Damit!
[This message has been edited by Dufty (edited 05-22-2003).]
|
mahjqa
Maniac (V) Mad Scientist
From: The Demented Side of the Fence Insane since: Aug 2000
|
posted 05-22-2003 21:57
Dufty; try again, and don't leave any spaces or enters on the top or bottom. that fixed it when mine wouldn't work.
|
Taobaybee
Maniac (V) Inmate
From: The Pool Of Life Insane since: Feb 2003
|
posted 05-23-2003 04:54
"Everything Crossed"!!
Way to go Suho1004,
[This message has been edited by Taobaybee (edited 05-23-2003).]
|
Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers
From: Germany Insane since: Sep 2001
|
posted 05-23-2003 10:05
as for sites not taking a .php as images (stupid coders behind them, no doubt),
you can also create a .htaccess that remaps mysig.jpg to mysig.php internally,
while the url will just contain mysig.jpg...
|