Welcome, Guest. Please Login or Register.
April 28, 2024, 08:10:29 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Dynamic Signatures/Footers « previous next »
Pages: [1] 2 Reply Ignore Print
Author Topic: Dynamic Signatures/Footers  (Read 9598 times)
Kevvv
Noobie
*
Posts: 8


I'm a llama!

Dynamic Signatures/Footers
« on: March 08, 2004, 12:10:18 AM »
Reply with quote

Hi, on some forums such as vBulletin users can have a dynmamic footer that changes every time a page is refreshed using a php script... well i was jsut woundering, if

a) it can be done on YaBB and
b) how do i do it  :P

thanks.
Logged
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:Dynamic Signatures/Footers
« Reply #1 on: March 08, 2004, 01:22:06 AM »
Reply with quote

It isn't related to the forum software... you can use those things on ANY forum, not just vbulletin.

For instance I have a random avatar here.

All you do is write a script that outputs the images data. Then link to it either in the avatar field or by putting:
[img]image_url_here[/img]

into the signature.
Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
Kevvv
Noobie
*
Posts: 8


I'm a llama!

Re:Dynamic Signatures/Footers
« Reply #2 on: March 08, 2004, 01:53:38 AM »
Reply with quote

hi could you pls help me on this matter... what kind of script that outputs image data?
Logged
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:Dynamic Signatures/Footers
« Reply #3 on: March 08, 2004, 01:57:06 AM »
Reply with quote

You just fopen(); the image, use fread(); on it. Then print what is returned from fread();

If you don't know php... then you probably don't have any idea what I just said.

You could try looking for a random image script somewhere... but this is generally what they do.
Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
Kevvv
Noobie
*
Posts: 8


I'm a llama!

Re:Dynamic Signatures/Footers
« Reply #4 on: March 08, 2004, 01:58:39 AM »
Reply with quote

yup that just confused me.
Logged
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:Dynamic Signatures/Footers
« Reply #5 on: March 08, 2004, 02:07:42 AM »
Reply with quote

Well let's just go with the basics first...

This script is a basic script to display an image:
<?php
$file 
fopen('image.gif','wb');
$data fread($file,filesize('image.gif'));
fclose($file);
die(
$data);
?>


It isn't random but it does show you the basics of displaying an image.

Then you just get some code to open a different image file at random and boom you have what your looking for.
Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
Kevvv
Noobie
*
Posts: 8


I'm a llama!

Re:Dynamic Signatures/Footers
« Reply #6 on: March 08, 2004, 02:09:17 AM »
Reply with quote

thanks alot for your help  :-*
Logged
Kevvv
Noobie
*
Posts: 8


I'm a llama!

Re:Dynamic Signatures/Footers
« Reply #7 on: March 09, 2004, 12:30:01 AM »
Reply with quote

heylo again ive been searching all day found loads of scripts but all kind of confused me.. i dont supose i could check out your script  :-[
Logged
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:Dynamic Signatures/Footers
« Reply #8 on: March 09, 2004, 12:40:13 AM »
Reply with quote

My script is kind of overkill... 175 lines, and 4kb big... it has extra features that most people wouldn't need.

Just look around there used to be some random avatar/sig scripts posted somewhere around here.
Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
Kevvv
Noobie
*
Posts: 8


I'm a llama!

Re:Dynamic Signatures/Footers
« Reply #9 on: March 09, 2004, 12:52:00 AM »
Reply with quote

i find disscousion on it but no help
Logged
Shadow's Pawn
Support Team
YaBB God
*****
Posts: 597


ich soll nicht toten

ICQ - 8039201shadowpawn@hotmail.com WWW
Re:Dynamic Signatures/Footers
« Reply #10 on: March 09, 2004, 01:04:44 AM »
Reply with quote

Here is a freeware script that should do what you need
Save this as a file called random.php or anything like that.


<?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;
     }
}
?>

Logged

apologize \A*pol"o*gize\, v. i. - To lay the foundation for a future offense.
Kevvv
Noobie
*
Posts: 8


I'm a llama!

Re:Dynamic Signatures/Footers
« Reply #11 on: March 09, 2004, 01:08:15 AM »
Reply with quote

okay thanks. so i how do it tell it which images to pick:?

if ($dir = opendir("http://servername.com/pictures/"))

is that correct?

and also ive been reading about .htaccess do i need to do anything with that?
Logged
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:Dynamic Signatures/Footers
« Reply #12 on: March 09, 2004, 01:29:39 AM »
Reply with quote

You don't need to edit that script to get it to work.

Just copy that code and paste into into a file and name it random.php.

Then just put the images in the same directory as that random.php file.
Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
Kevvv
Noobie
*
Posts: 8


I'm a llama!

Re:Dynamic Signatures/Footers
« Reply #13 on: March 09, 2004, 01:39:17 AM »
Reply with quote

ahh nice sorry i was thinking it was more complex than it really was, cheers.
Logged
HyperDev
Full Member
***
Posts: 210


Have drumsticks, will travel.

gtcproject@hotmail.com WWW
Re:Dynamic Signatures/Footers
« Reply #14 on: March 09, 2004, 05:07:14 PM »
Reply with quote

Note about all of this: IPB forums won't accept .php as an image suffix. You can solve this with .htaccess. Just have a .jpg (or whatever) processed through PHP's engine, and name your script ***.jpg (or whatever).
Logged

--JC

HyperDev Admin

Will drum for food TO PISS GIRLS OFF! (Only reason I'd do anything.)

Proud Member of HHS Drumline

Mach8 and [Unknown], I still don't know how you convinced me girls aren't evil.

And please, SAVE THE LLAMAS!!!
Pages: [1] 2 Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Dynamic Signatures/Footers « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.053 seconds with 20 queries.