Closed Thread Icon

Topic awaiting preservation: testing sig rotator Pages that link to <a href="https://ozoneasylum.com/backlink?for=13590" title="Pages that link to Topic awaiting preservation: testing sig rotator" rel="nofollow" >Topic awaiting preservation: testing sig rotator\

 
Author Thread
bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-22-2003 22:44

just a test to see if I hooked up Master Suho's sig rotator correctly... Don't mind me!


Cell 617

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-22-2003 22:46

nope, not the first time! Let's see if this worked...




Cell 617

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-22-2003 22:49

Ok, someone feel free to step in here... This is what I did:


I copied and pasted the code from Suho's cell to a notepad page and saved it as "rotate.php" as directed. edit - ok, I was directed to name it "index.php", but that shouldn't matter, right?

I uploaded the file to my web server in the image file

I changed my sig link to read: http://www.annbeckett.com/sigs/images/rotate.php " alt="" border="0" /> (sans the obvious spaces, of course).

Yet it's still displaying the sig I had linked previously.

Have I done something drastically wrong here? I wasn't supposed to make any changes to the code, right?

SUHO! Help! I think I need to visit the Shock Therapy room... been a while since the last one.


Cell 617

[This message has been edited by bodhi23 (edited 10-22-2003).]

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-22-2003 22:58

one more try...

edit - nope, not happening...

Someone tell me what I've done wrong please?


Cell 617

[This message has been edited by bodhi23 (edited 10-22-2003).]

[This message has been edited by bodhi23 (edited 10-22-2003).]

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-23-2003 13:17

Ah, OK, let's take a look here... it's been a while since I've even looked at the code, but it hasn't changed for quite a while (a few months), and people were using it with no problems before.... which means something has gone wrong somewhere along the way.

I apologize for the silly questions, but I have to ask, just to make sure:

  • Is the PHP file located in the same directory as your images?
  • Do you have more than one image in the directory?



If you answer "yes" to both of these questions, then it should work...

It shouldn't matter what the file is called--I only suggest index because it makes linking easier (and more transparent--i.e., it isn't so readily apparent that you are using a php sig rotator). Just for the heck of it, though, try renaming the file index.php and then linking to the directory.

If it still doesn't work, I can only assume that: a) the code was somehow changed in the process of copying and saving, or b) there is something in your directory (or in the way things are set up) that is preventing the script from working. To eliminate the first possibility, try checking the code again. You might even want to try wiping it out and recopying it. As for the second possibility, I can't really imagine what might do that, but it's the only other thing I can think of.

If you still can't get it to work, drop me a line on ICQ (#171380444).


___________________________
Suho: www.liminality.org

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-23-2003 16:25

Ok, I deleted the file I had yesterday, and have recopied the code, save it as "index.php" and linked to it in my profile with:

http://www.annbeckett.com/sigs/images/index.php " alt="" border="0" />

Let's see if this works...


Cell 617

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-23-2003 16:27

Oh, that's not good... a nice little red X. Not one of mine...




Cell 617

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-23-2003 16:28

ok, once more...

edit - no dice.
It is the "img" tag that goes with it, right?
Does it matter what program I used to copy and save it? I used notepad. There's nothing in the folder with the code but 4 .gif images. Can't think of any reason why it won't work.
Here's the code I copied:

quote:
<?php
//////////////////////////////////////////////////////////////////////
/* Suho1004's PHP Sig Rotator V2.0 */
/* */
/* This script takes an inventory of all image files in a directory */
/* and displays one at random. All you need to do is save this code */
/* in a directory that contains your images (name it what you will, */
/* but make sure it has a ".php" extension). Then just link to this */
/* script to get your random image. */
/* */
/* I would recommend naming this file "index.php," and then you can */
/* just link to the directory itself (like I do in my example). */
/* */
/* Once you've read these instructions, feel free to delete them to */
/* cut down on the file size. I claim no rights to this code, which */
/* means you can do whatever you like with it. Have fun. :-) */
/* */
/* Thanks to TP for the gentle nudging... */
//////////////////////////////////////////////////////////////////////

if ($dir = opendir("."))
{
$list = buildimagearray($dir);
displayrandomimage($list);
}

// This function reads all the files in the current directory and adds all image files to the array $list[]
function buildimagearray($dir)
{
while (false !== ($file = readdir($dir)))
{
if (!is_dir($file) && getimagesize($file))
{
$list[] = $file;
}
}
return $list;
}

// This function selects a random image, determines the mime type, opens the file for reading,
// and then outputs the image
function displayrandomimage($list)
{
srand ((double) microtime() * 10000000);
$sig = array_rand ($list);

$size = getimagesize ($list[$sig]);
$fp = fopen($list[$sig], "rb");

if ($size && $fp)
{
header("Content-type: {$size['mime']}");
fpassthru($fp);
exit;
}
}
?>



See anything unusual?

Cell 617

[This message has been edited by bodhi23 (edited 10-23-2003).]

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-23-2003 16:34

just had a flash of insight - link to the directory, not the file?

Let's see if this works...

edit - nope. Assistance at this point would be appreciated. Thanks Master Suho...


Cell 617

[This message has been edited by bodhi23 (edited 10-23-2003).]

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 10-23-2003 21:27

Bodhi,

everything seems pretty cut and dry. Do you have more than the one image in the directory [images]??

copying the code and pasting into notepad should be fine. It is a *.php page or it wouldn't show up at all...

I'll try it out when I get home using your exact code you posted here and see if it works for me.

Later,

C:\


~Binary is best~

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-24-2003 03:00

bodhi: It's a good idea to include the trailing slash when linking to a directory. Without the slash, the server will first search for the file, and then try directories when it can't find a file by that name.

Other than that, I can't see anything wrong... I used the same exact code myself (to the letter). In fact, I'll try it out here to make sure it works:



Here's another thing: the code is actually displaying an image. If you had somehow dropped a character from the code when cutting and pasting it, it most likely would not work at all. But it is working, more or less... let's see if it works on my server first...

[Edit]Yup, works fine for me. I can only assume at this point that something is wrong on your end, but I can't for the life of me figure out what it is. You say that there are four .gif files in the directory? Here's another silly question: are they all different images? If so, then I honestly cannot understand what might be wrong.

Do you use ICQ? If so, drop me a line, and maybe we can work it out in real time. It's a bit tough to try to troubleshoot it here...[/Edit]

[This message has been edited by Suho1004 (edited 10-24-2003).]

Nemesis
Nervous Wreck (II) Inmate

From: Uranus
Insane since: Aug 2003

posted posted 10-24-2003 04:07

Going straight to the directory works.... but it only rotates the one sig.

Are you sure you have more than one image in there.......?

Jason





^Testing to see if it works^

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-24-2003 22:53

I added the trailing slash to see what will happen:
the link now reads:
[img] http://www.annbeckett.com/sigs/images/index.php/ [img]

Jason - your post seems to yield the same results as my previous attempts.

Suho - what's your real time difference from EST? It could be difficult for the two of us to hook up that way, though I did add you to my ICQ.
However, C:\ is right here in town... any luck Curt?

You think it could have something to do with my hosting server? Is there something I should look for specifically in my hosting package that might make a difference? I use ReadyHosting. Not had too many problems, but then I haven't tried to do anything remotely programming related either...

Let's see if the change worked...
edit - ok, the trailing slash gives me the red X... thoughts on this? I do have 4 completely different images with different names in the file folder... they're all animated .gifs, but that shouldn't make any difference. Perhaps I should try a different rotator code and see what happens?

edit again - ok, the web hosting package says PHP extensions are supported. I'm pretty sure I should not be having this problem. Do you think that the path to it is too long? Should that be a concern?



Cell 617

[This message has been edited by bodhi23 (edited 10-24-2003).]

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-25-2003 05:27

On the trailing slash: a slash at the end of a URL tells the server that you are looking for a directory, so it should only be used when you are linking to a directory. That is, no slash if you're linking to the PHP file itself, slash if you're linking to the directory.

Time difference from EST is 13-14 hours (depending on DST, which we don't do here). That means, basically, that when it's night for you it's morning for me, so we should be able to catch each other at the beginning/end of the day. I didn't get a confirmation request from you, though, so while I may appear on your list, you're not on mine... let me see if I can add you...

Also, as I mentioned before, if there was something wrong with the script (or if your server didn't support PHP), it wouldn't work at all (ie, you would just see a red X). It works on my server, it works on other people's servers, so I can't figure out for the life of me why it doesn't work on your server. If we ever hook up on ICQ, I can send you some php test scripts that might help us pinpoint the problem. It would require us to be talking in real time, though, as I imagine there will be a lot of info going back and forth (basically I would send you the scripts, you would run them, and then you'd tell me what they do, and from that I'd try to figure out what is going on).


___________________________
Suho: www.liminality.org

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 10-25-2003 11:53

ok, I can see the sig rotator when I access it directly (without the trailing / though).

only ever shows one sig, though.

Now, suho's script should be sending out the right header... maybe replace that header("content-type": $size... with header("content-type: image/jpeg")...
could be that your server's not reading that right.
What kind of server is it?

so long,

Tyberius Prime

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-25-2003 16:15

TP: If the server's not sending the right heading, then it wouldn't display at all, no? That's what's bugging me here--if there was something wrong, it wouldn't display anything...

Also, all of her images are gifs (right?), so the header should be image/gif.

Bodhi: I've added you to my ICQ list, so maybe we can try this out in real time (if you're going to be around on Sunday evening, I'll be available). We can try out some stuff (like what TP suggested) and maybe figure this thing out.


___________________________
Suho: www.liminality.org

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 10-25-2003 17:31

boy I tried to run that script on my box at home using phpDev and MAN! Some crazy stuff came out. Guess you can do it like that?
I just tried to access the index.html and WOOO!!!!

crazy stuff maynard!

Later,

C:\


~Binary is best~

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-26-2003 08:27

CPrompt: The script works on PHPdev--that's how I developed it in the first place. I'm not sure if you just copied and pasted the code bodhi quoted further up, but I just noticed that she left out the "<?php" that's supposed to come at the beginning of the code. If you try to run the code without this it will just display the source.

bodhi: I've got a debugging script ready to go. You're now on my Q list, so if I catch sight of you I'll send this script on over and you can try it out...

___________________________
Suho: www.liminality.org

Dufty
Paranoid (IV) Inmate

From: Where I'm from isn't where I'm at!
Insane since: Jun 2002

posted posted 10-26-2003 12:54

Good to see you back master suho
I've never managed to get this to work either, I'm going to try some of the suggestions above.
Here goes...



-> edit - D'oh!
-> edit again - Woohoo!

Changed to: header("Content-type: image/gif"); and changed the link back to index.php and it seems to work just fine! Yay!

[This message has been edited by Dufty (edited 10-26-2003).]

Snookumz
Bipolar (III) Inmate

From: California
Insane since: May 2003

posted posted 10-26-2003 14:00

Dufty, maybe on the blossom tree you could end the animation with the blossoms falling off so that when the animation repeats the blossoms dont just "poof!"


[This message has been edited by Snookumz (edited 10-26-2003).]

Dufty
Paranoid (IV) Inmate

From: Where I'm from isn't where I'm at!
Insane since: Jun 2002

posted posted 10-26-2003 14:51

Already working on that version and other enhancements Snookumz
See here for the full story.

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-26-2003 17:22

Ok, I changed the Content Type to image/gif. Let's see if that took...

Suho - I'll be around this evening... I'll try to remember to get back on to see if we can't hook up if this doesn't work...

edit - ok, this is getting f**king bizarre! I'll try to sign on about 7 or 8 here - will that work for you?

Cell 617

[This message has been edited by bodhi23 (edited 10-26-2003).]

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-27-2003 01:30

It should now be around 7:30 in your time zone... I saw you online just as I signed on, but then my connection went fuzzy, and when I came back you were gone. Why did you skedaddle so quickly?




___________________________
Suho: www.liminality.org

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-27-2003 02:09

Trying to do too many things at one time this evening... That's what it is... I did have a brief problem with my connection there... You seem to be having a few yourself...




Cell 617

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-27-2003 02:55

Yup, my connection is being quite annoying this morning.

However, I am pleased to report that the problem has now been fixed, and bodhi is off spending time with her husband.

For those of you following along at home, apparently bodhi's version of PHP (4.2.2) wasn't handling array_rand() too well. I replaced this section of the code with a simple rand(), and it seems to work fine. The updated code will be on the sig rotator page as an alternative "fix" version if anyone is interested.


___________________________
Suho: www.liminality.org

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-27-2003 14:22

Ok - here's the fixed test...


Cell 617

[This message has been edited by bodhi23 (edited 10-27-2003).]

bodhi23
Paranoid (IV) Inmate

From: Greensboro, NC USA
Insane since: Jun 2002

posted posted 10-27-2003 14:28

Many bowings and scrapings to the Master! Yay!



Cell 617

[This message has been edited by bodhi23 (edited 10-27-2003).]

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-27-2003 15:00

I'm just glad we could get that sorted out.

I wonder, though, if this was a bodhi-specific problem, or if this is indicative of the way things work in 4.2... I suppose we'll find out as more people upgrade.

[Edit: Whoa, I totally missed your post up there, Dufty. Yep, it's good to be back.

Just out of curiosity, what version of PHP are you using? And using image/gif for your mime type is cool as long as you don't go throwing jpegs in there--I don't understand why it doesn't work, but if changing that fixes your problem, more power to you. Also, linking to the directory (with index.php) and linking to another file should produce exactly the same results.

Anyway, glad to see you were able to work that out on your own. Sorry I missed your post... I wasn't intentionally ignoring you.]


___________________________
Suho: www.liminality.org

Dufty
Paranoid (IV) Inmate

From: Where I'm from isn't where I'm at!
Insane since: Jun 2002

posted posted 10-27-2003 16:14

's ok Suho.. mumblemumbleignorantu]m*b*le9!5[o

Using PHP4 on windows 2000 (provided by Hostway so unfortunately, that's all I can tell you).
Anyways, whatever the reason, it seems to work fine, which makes me v.happy indeed

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 10-28-2003 02:16

Hmm... the vagaries of PHP... oh well, at least everything's working now.


___________________________
Suho: www.liminality.org

« BackwardsOnwards »

Show Forum Drop Down Menu