Seite 1 von 2

Zufallsbilder in der Signatur?

Verfasst: 05.09.2005 16:45
von maenumania
Gibt es einen Mod der es mir ermöglicht Zufallsbilder in meiner Sig anzuzeigen? Muss nicht für alle User gehen, reicht wenns für mich geht ;)

Gruss

Verfasst: 20.09.2005 09:45
von maenumania
Keiner eine Idee?

Verfasst: 20.09.2005 10:03
von rkern
Du kannst ein php-Skript als Bild angeben. Was das Skript dann zurücksendet, ist nur von Deinen programmiertechnischen Fähigkeiten beschränkt.

So wird z.B. mein Signaturbild erzeugt: ein Bild als Grundlage und mit GD Text dazugeschrieben.

mfg Ralph Kern

Verfasst: 20.09.2005 10:23
von maenumania
Hm... jetzt müsste man nur noch programmieren können :(
Es muss ja nicht viel können, nur ein Bild aus einem Ordner zufällig auswählen
wie scripte ich das am besten?
und wie füge ich das nachher in meiner signatur ein?

Verfasst: 20.09.2005 13:36
von rkern
Nun, Skripte, die ein Bild aus einer Menge auswählen und darstellen, gibt es wohl zuhauf. Google mal nach "banner rotation php".

mfg Ralph

Verfasst: 20.09.2005 14:09
von maenumania
Danke, hab eins gefunden, aber irgendwie zeigts mir das bild trotzdem nicht an

Wenn ich es mittels diesem Code einbinden will:

Code: Alles auswählen

<img src="http://www.maenumania.ch/forum/signatur/banner.phtml" alt="Zufallsbild">
Erscheint nur das weisse feld mit dem roten X, html und den img-code hab ich auf meiner page aktiviert...



das wäre der code den ich habe

Code: Alles auswählen

<?php
/* banner.phtml
   Banner rotation script for PHP3 by Anton Olsen (aolsen@graphweb.com)
   Please feel free to do with this script what you want, all I ask is
   that if you make significant changes, please e-mail them to me.

   I tried to use a number of different methods, the image functions
   of PHP do not appear to understand animated GIFs and the file
   handling features (fopen, fpassthru, and fclose) were causing
   apache to crash on me.  I settled on using passthru.  Although
   possibly not as portable, it appears to work faster than either
   method mentioned above.

   Assumptions:
   You have a directory for all your banners.
   All banners are GIF files.
   The filenames of the banners all start with banner.
   There are no other files in the directory starting with banner.

   Installation:
   Place this script in the banners directory.
   Place all your banner*gif files in the same directory.
   Add the following HTML code to your web pages :
     <a href="wherever.you.want.com">
     <img src="http://www.yourserver.com/bannerdir/banner.phtml" alt="Random Banner Here" border=0>
     </a>

*/

/* random( $max integer )
   Returns a random number between 0 and $max-1;
*/
function random( $max )
{
        $x = rand();
        $y = getrandmax();

        $r = $x / $y * ($max -1 );

        $r = round( $r++ );
        return $r;
}

/* Read the directory, add all "banner*" files with to the array
*/
$i = 0;
$d   = dir(".");
while($entry=$d->read())
        if (substr($entry,0,6) == "banner")
                $array[$i++] = $entry;
$d->close();


/* pick a banner at random
*/
$r = random( $i );

/* Send a no-cache header, and the gif type header, and output the file.
*/
Header( "Pragma: no-cache" );
Header( "Expires: Monday 01-Jan-80 12:00:00 GMT" );
Header( "Content-type:  image/gif");
passthru( "cat $array[$r]" );

?>
weiss jemand weiter?

Verfasst: 20.09.2005 14:37
von Demonking
öhm.. die datei vllt als php abspeichern? o.O
phtml bei mir wird dann nur dein quelltext angezeigt :D
und benutzt php code also server muss php unterstützen und die datei muss .php heissen also ncih das banner.html sondern das banner.php

Verfasst: 20.09.2005 14:46
von maenumania
und das läuft bei dir jetzt?

hab die datei jetzt umbenennt in banner.php, aber es läuft immer noch nicht...

Verfasst: 20.09.2005 15:02
von Demonking
xD ok eben fehler vllt gefunden ;)
heissen alle deine dateien am anfang banner.

Verfasst: 20.09.2005 15:04
von maenumania
yep, bannerx.gif heissen alle

hab einfach mal zum testen ein paar bilder raufgeladen...hat ja keine grössenvoraussetzung, oder?