Closed Thread Icon

Topic awaiting preservation: PHP Random Image (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12065" title="Pages that link to Topic awaiting preservation: PHP Random Image (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP Random Image <span class="small">(Page 1 of 1)</span>\

 
Dark
Neurotic (0) Inmate
Newly admitted
posted posted 02-22-2002 17:43

Ive recently got ahold of a PHP script that will randomly display graphics on a page...

This is the script

code:
<?
Header("Content-type: image/gif");
Header("Cache-Control: no-cache, must-revalidate");
srand((double)microtime()*1000000);$nr=rand(1,8);
$fn=fopen("$nr.gif","r");
fpassthru($fn);
?>



Can this scipt be modded so all the graphics on the page are not the same? So it chooses a new avatar each time it loads a new graphic? I know I've seen this done before. Lots of people do it on thier sigs. I want to modify it to where if say I have 10 posts in one thread .. each avatar will be diffrent.


- Jon



[This message has been edited by Dark (edited 02-22-2002).]

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 02-22-2002 18:58

Well, I don't think that you can do that.
Most browsers will just reuse the image if it is displayed more than once on a page (and this is a feature, not a bug!).
So even if you set it not to cache the image, it would only work when people reload the page (and then all avatars would the same, different avatar).

so long,

Tyberius Prime

Dark
Neurotic (0) Inmate
Newly admitted
posted posted 02-22-2002 21:44

Interesting .. anyone else have a comment on this? Can it be done?

- Jon

ShrineMaster
Obsessive-Compulsive (I) Inmate

From: Somewhere in Iowa
Insane since: Feb 2002

posted posted 02-23-2002 08:02

Add some random argument to the URL you're calling the script with...

image.php?1
image.php?2
image.php?3

The browser will see these as 3 different images, but uou may still wind up with duplicates on the page by random chance.


Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 02-23-2002 12:10

yes, and I can't see how you would implement that in a standard signature or avatar.
but, of course you could always enter the 'signature' into the text box, and change that everytime.
but then you might as well just link to the image.

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 02-23-2002 23:32

Forgive my ignorance...

But could someone please explain to me just what the heck an avatar is?

Thanks

-Butcher-

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 02-24-2002 09:06

This is an explanation from vBulletin's FAQ page:

--- start copy/paste ---
Avatars are small graphical images that you may choose in your profile. They are displayed below your username on all posts that you make. You can select the image that best describes yourself from your profile options.
--- end copy/paste ---


butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 02-24-2002 12:54

Thanks mr.maX

-Butcher-

Dark
Neurotic (0) Inmate
Newly admitted
posted posted 02-25-2002 13:48

Exactly, They can usually be anywhere from 50x50 to 100x100. Many forums allow their users to have them.



ICQ # 132364102

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 02-26-2002 11:45

perhaps this would help:
http://kameelah.org/eassoft/php_files/rndimg.html

« BackwardsOnwards »

Show Forum Drop Down Menu