Shoutbox

Help-Random sig - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Help-Random sig (/showthread.php?tid=47206)

Help-Random sig by Lou on 07-05-2005 at 04:33 AM

How can I create a random sig? I used to have a .php file that worked great but now it doesnt work for some reason.... [hosting it on my server]


RE: Help-Random sig by ShawnZ on 07-05-2005 at 04:39 AM

what doesn't work with it..?


RE: Help-Random sig by John Anderton on 07-05-2005 at 04:43 AM

Does your server have php 4 / 5 ie is it php 4 / 5 compliant ??


RE: Help-Random sig by ipab on 07-05-2005 at 05:17 AM

do you have GD and or GD2 libraries installed on your server?


RE: Help-Random sig by -dt- on 07-05-2005 at 05:56 AM

quote:
Originally posted by ipab
do you have GD and or GD2 libraries installed on your server?
thats not needed....

btw this uses a php5 only function "scandir" so if you dont have php5 ill post the changes for it to work with php4

code:
<?php
error_reporting(E_ALL ^ E_NOTICE);


$folderdir = "./pics"; //EDIT THIS
$types = array('jpeg','.png','.bmp','.jpg','.gif');

//------ dont edit--------
$dir = scandir($folderdir);
$files = array();
for ($i=0;$dir[$i];$i++){
$ext=strtolower(substr($dir[$i],-4));
if (in_array($ext,$types)){
$files[]=$dir[$i];
    }
}

$image =  $files[rand(0,count($files)-1)];
$ext=strtolower(substr($image,-4));
$ext = str_replace('.','',$ext);

Header ("Content-type: image/$ext");
readfile($folderdir . '/' .$image);


?>


RE: Help-Random sig by Lou on 07-05-2005 at 04:00 PM

it has php5 but my other server doesnt...I used to run it on my other server fine...but it doesnt now


RE: Help-Random sig by ipab on 07-05-2005 at 11:02 PM

quote:
Originally posted by -dt-
    quote:Originally posted by ipab
    do you have GD and or GD2 libraries installed on your server?


thats not needed....

heh, forgot thats for image manipulation (i.e. adding text to images). :$

quote:
Originally posted by lou_habs
it has php5 but my other server doesnt...I used to run it on my other server fine...but it doesnt now


for php4 I believe the alternative should be opendir instead of scandir


RE: Help-Random sig by Lou on 07-06-2005 at 01:05 AM

sorry to be a bit far but where do I save the file for php 4? and who ahs any good scripts to use for the random image itself?


RE: Help-Random sig by ipab on 07-06-2005 at 01:34 AM

well if you want a script that is really good, then you should try chameleon (aka ksmas). It is made by a member on this board called keystorm and its really good.


RE: Help-Random sig by Lou on 07-06-2005 at 02:21 AM

heard of it but was unable to find it...


RE: Help-Random sig by -dt- on 07-06-2005 at 04:07 AM

php 4 method , also no offence but I find kmas way too complex for such a simple thing

code:
<?php
error_reporting(E_ALL ^ E_NOTICE);


$folderdir = "./pics"; //EDIT THIS
$types = array('jpeg','.png','.bmp','.jpg','.gif');

//------ dont edit--------
$dir = array();
$folder=opendir($folderdir);
while ($file = readdir($folder)) $dir[] = $file;
closedir($folder);
$files = array();
for ($i=0;$dir[$i];$i++){
$ext=strtolower(substr($dir[$i],-4));
if (in_array($ext,$types)){
$files[]=$dir[$i];
    }
}

$image =  $files[rand(0,count($files)-1)];
$ext=strtolower(substr($image,-4));
$ext = str_replace('.','',$ext);

Header ("Content-type: image/$ext");
readfile($folderdir . '/' .$image);


?>


RE: Help-Random sig by Lou on 07-06-2005 at 10:16 PM

well I would still like to try it out...how do I find it?


RE: Help-Random sig by ipab on 07-07-2005 at 12:30 AM

http://sourceforge.net/projects/ksmas


RE: Help-Random sig by Lou on 07-07-2005 at 01:11 AM

* Lou loves the script


RE: Help-Random sig by John Anderton on 07-07-2005 at 11:22 AM

quote:
Originally posted by ipab
http://sourceforge.net/projects/ksmas
quote:
Originally posted by lou_habs
* lou_habs loves the script
KSMAS has some known problems like you cant login again after adding your avatars and sigs. Yeah it happened to me and i told KS. He said that he knew that problem and its all gonna be ok (seemingly) in the new CBC which should be (hopefully) released in a few months.

Btw for those who are new ....
KSMAS = KeyStorm's Multi Avatar Script
CBC = Chameleon Board Companion
RE: Help-Random sig by KeyStorm on 07-12-2005 at 02:40 PM

Thanks for stating this, john. I'm extremely idle lately and didn't notice this thread.

As for CBC it's on its way and it will fix all issues concerning login and setup as well as opening the script to a new plugin-based concept.

quote:
Originally posted by -dt-
I find kmas way too complex for such a simple thing
The quick fact that a large amount of people doesn't even know what PHP means explains why KSMAS was taken to a higher coding complexity level to ensure everything is easy to set up and to offer as many options as possible to cope with most dynamic image needs. ;)

That and I was kinda sick of making custom dynamic avatar scripts for every single case having to tell people to upload images, create folders and whatsoever :P
RE: Help-Random sig by absorbation on 07-12-2005 at 03:00 PM

ksmas does not work well for me i dont know which version yo use and i cant delete it from ftp :cry: which one did hobbes use :P i sent you an e-mail about it :P


RE: Help-Random sig by KeyStorm on 07-12-2005 at 05:21 PM

You can use the uninstaller you'll find on the project page.


RE: Help-Random sig by absorbation on 07-12-2005 at 05:27 PM

quote:
Originally posted by KeyStorm
You can use the uninstaller you'll find on the project page.

yeh i just found it :P which is the most stable and the one yu gave hobbes :)

thanks
RE: Help-Random sig by L. Coyote on 07-12-2005 at 10:20 PM

KS, I hope the new version supports remote images. :P

I had to make a mini-script to be able to use the images at photobucket.com :P


RE: Help-Random sig by KeyStorm on 07-12-2005 at 11:00 PM

In fact the new version will have an MPI-based plugin system, so it will be able to work with existing uploaded images in many ways.

However the use of external images is not a good practice and technically not going to happen since it would allow image stealing and also could cause severe HTTP flaws (like sending a 404/File not found or what's worse a 401/Auth Needed).

You'll still have to upload your images which makes sure they will work safely.


RE: Help-Random sig by leito on 07-13-2005 at 12:39 AM

quote:
Originally posted by Killov
KS, I hope the new version supports remote images. :P

I had to make a mini-script to be able to use the images at photobucket.com :P


Well I don't see the point of having remote images, when having a server with PHP (Which I assume you pay and have space available). I'm sure you have 1 MB for avatars in that server.
RE: Help-Random sig by L. Coyote on 07-13-2005 at 01:44 AM

quote:
Originally posted by leito
Well I don't see the point of having remote images, when having a server with PHP (Which I assume you pay and have space available). I'm sure you have 1 MB for avatars in that server.
Yeah, but the bandwidth is a little bit less with just a redirect. The remote site serves my avatars. ;)

And there's also personal convenience.
RE: Help-Random sig by KeyStorm on 07-13-2005 at 06:07 PM

quote:
Originally posted by Killov
The remote site serves my avatars.

That's indeed stealing. Not going to happen in CBC, sorry.
RE: Help-Random sig by L. Coyote on 07-13-2005 at 10:04 PM

quote:
Originally posted by KeyStorm
quote:
Originally posted by Killov
The remote site serves my avatars.

That's indeed stealing. Not going to happen in CBC, sorry.
:rofl: From my own account at photobucket? Whatever.