PDA

View Full Version : Random Comic Request


Exodist
08-29-2007, 3:03 PM
Hello Explosm Go'ers,
I am requesting, considering now that C&H has reached a very high amount of comics, that a special, random image generator be put in place. I myself, am much of a forum troll, and I would enjoy this a lot, as I'm sure that a lot of other people would.

<?php
$extList = array(); $extList['gif'] = 'image/gif'; $extList['jpg'] = 'image/jpeg'; $extList['png'] = 'image/png';
$img = null;
$fileList = array();
$handle = opendir('./');
while ( false !== ( $file = readdir($handle) ) ) {
$file_info = pathinfo($file);
if (isset( $extList[ strtolower( $file_info['extension'] ) ] )) { $fileList[] = $file; }
}
closedir($handle);
$imageNumber = time() % count($fileList);
$img = './' . $fileList[$imageNumber];
if ($img!=null) {
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($contentType);
readfile($img);
}
?>

PS. Had to switch to quote tags because there is no [code] tags :aaa:

Mr Anorexia
08-29-2007, 3:04 PM
:aaa:

Shagg
08-29-2007, 3:06 PM
:aaa:

I'm not sure wether to be suprised, happy, or angry... :mmyes:

Exodist
08-29-2007, 3:07 PM
That smiley is almost as disturbing as Mr. Anorexia's avatar. :\

Benjaman
08-29-2007, 3:09 PM
I've been wondering why they haven't had something like this for a while...

Matterialize
08-29-2007, 3:10 PM
Uh, what?

Assassin
08-29-2007, 3:12 PM
Yes indeed, that would be delightful :mmyes:

Oofie
08-29-2007, 3:13 PM
I'm lost.. Someone care to elaborate?

Exodist
08-29-2007, 3:15 PM
Eek, I forgot to write up directions for this code D:

Alright.
~You need all of the images in one folder, called sig.jpg [yes its retarded, but I'm too lazy to change the code]
~Place the above code in a file called "Index.php" and drop it into the sig.jpg folder.
~Transfer all images to sig.jpg folder
~The URL should turn out something like this: ../explosm.net/sig.jpg/index.php - it will automatically come up with an image, randomly :)

Stephen
08-29-2007, 3:16 PM
a random comic page
where if you refresh it will just pull up a random comic of the hundreds

Shagg
08-29-2007, 3:17 PM
Yes indeed, that would be delightful :mmyes:

Hmm, yes.. I concur. Splendid! :mmyes:

Relaps
08-29-2007, 3:17 PM
Exodist: Pretty kickass idea.

Shagg
08-29-2007, 3:18 PM
Exodist: Pretty kickass idea.

Custom Title for the Lad? Anyone agree?

BAN ME PLEASE
08-29-2007, 3:19 PM
here

Relaps
08-29-2007, 3:19 PM
Custom Title for the Lad? Anyone agree?

No. Though kickass, not title-worthy.

Exodist
08-29-2007, 3:20 PM
a random comic page
where if you refresh it will just pull up a random comic of the hundreds

Yes, that is correct. If you look at this part of the code:


$imageNumber = time() % count($fileList);
$img = './' . $fileList[$imageNumber];
if ($img!=null) {

It basically says, count the number of images, select an image at random, if there is no image, show no image. Not that hard when you get to know a lil PHP ;)

Oofie
08-29-2007, 3:21 PM
That's pretty damn cool.

Thanks for explaining too :)

Cristo
08-29-2007, 3:26 PM
Absolutely spiffing old chap, thoroughly well thought and really rather splendid.

:D

Exodist
08-29-2007, 3:41 PM
Sooooooooo. Any chance of getting this up on Explosm? =D

Matterialize
08-29-2007, 3:57 PM
Hey, cool idea. I think you admin types should do it.

PyroOwned
08-29-2007, 4:01 PM
I have no clue how to do this. Help please?

Matt
08-29-2007, 4:02 PM
Thank god, my limited grasp of coding was the only thing stopping me from implementing such a feature. YOU ARE A GODSEND, GOOD SIR.

Jallen
08-29-2007, 4:07 PM
I sense a wee bit of sarcasm from Matt.

Zaren
08-29-2007, 4:08 PM
He should replace kwanzaa, cause he's obviously smarter.

Jallen
08-29-2007, 4:10 PM
Hmmm. Exodist, do you have any plans on crashing the forum any time soon?

Soul
08-29-2007, 4:10 PM
He should replace kwanzaa, cause he's obviously smarter.

Zaren :confused: aren't you banned?



But yeah its a good idea to have a random comic page but its not like its an extremely complicated thing to do.

Matt
08-29-2007, 4:13 PM
I have more important things to take care of at the moment.

Exodist
08-29-2007, 4:14 PM
I have no clue how to do this. Help please?

PM me and I'll guide you through it.


@Matt: Are you an admin :o

Jallen
08-29-2007, 4:16 PM
That's what the flame means.

Exodist
08-29-2007, 4:20 PM
Considering that this task only took me two minutes to complete, minus transferring the images. >_>

Exodist
08-29-2007, 5:09 PM
Just for the record, here's an example that one of my friends did.
http://paradoxd.com/pics/sig.png
^ Just remember to refresh the page to view a different image ^

lollercaust
08-29-2007, 5:41 PM
I have a feeling explosm's bandwidth would explode if a ton of it's fanbase just kept refreshing a page every few seconds to see an old comic they forgot about to laugh at.

At the same time, I'd love this for the same reason I think people are gonna screw it up. :)

Stealth Prawn
08-29-2007, 6:23 PM
Wow. That's spectacular.

Seriously, someone should get him a title, that was amazing.

Oberlin
08-29-2007, 8:03 PM
Surprised nobody thought of this before.

Exodist
08-29-2007, 8:06 PM
I've been around Explosm a lot, but never really traveled to the forums until I thought of this idea. *Feels everyones love*

Mr. Crow
08-29-2007, 8:10 PM
What's the point of this?

Like, to randomly generate a comic at the top of the forums page?

Raxo
08-29-2007, 8:10 PM
Wow. That's spectacular.

Seriously, someone should get him a title, that was amazing.

It's a good idea but seriously not title worthy.

Killer Carebear
08-29-2007, 8:15 PM
MK: I think he's trying to imply that if an admin takes the code and puts it on the comic page it would generate a random comic. Kind of like the radom comic button on this site:http://www.pbfcomics.com/?cid=PBF227-The_Masculator.jpg#212

Exodist
08-29-2007, 8:17 PM
What's the point of this?

Like, to randomly generate a comic at the top of the forums page?

It can be used for that purpose, but my main intention was for personal pleasure and forum signatures/avatars.

If the head admin wanted, who ever he is, this is what he could do.
go to the ../images/prdy/may07/ folder, rename may07 to sig.jpg, place a bunch of banners and sayings in there, things like, Explosm.Net: Your daily comic source. Things like that.

BKS
08-29-2007, 8:17 PM
No. Though kickass, not title-worthy.



Agreed 100 percent.

Exodist
08-29-2007, 8:25 PM
Thanks
;_;

lollercaust
08-29-2007, 8:48 PM
Exodist, welcome to the forum. Some people will bash you, some won't. You've made a good start, considering most newbs here get banned first post.
It seems like your idea and work has gained a lot of popularity, and seeing as all the leaders haven't put it down completely it may be something that does happen. Trying to understand the code actually is a good way to waste my time. :D

Exodist
08-29-2007, 8:59 PM
Exodist, welcome to the forum. Some people will bash you, some won't. You've made a good start, considering most newbs here get banned first post.
It seems like your idea and work has gained a lot of popularity, and seeing as all the leaders haven't put it down completely it may be something that does happen. Trying to understand the code actually is a good way to waste my time. :D

Yea, I know, I've been a forum troll for about 2 years now, I've seen just about everything. You don't know put-downs til you start lurking on 4chan.org D:

InTransit
08-29-2007, 10:11 PM
Just go to the archive, close your eyes & click on a random image. So much easier.

Kwanza
08-29-2007, 10:16 PM
Neat idea, thank you for that code. Years of training never would've allowed me to create such an complex piece of programming.

Exodist
08-30-2007, 12:08 AM
Here you go pal,
http://www.lsl.com.au/images/images-ref/php-mysql-for-dummies.jpg
;)

Savaril
08-30-2007, 3:57 AM
So it can be used for personal pleasure?


....


:heya:

John Travolta
08-30-2007, 6:06 AM
You should replace kwanza.

Chriz
08-30-2007, 6:15 AM
I have more important things to take care of at the moment.

How is that singing career coming along Matt ?

Jiggz
08-30-2007, 6:26 AM
Also, do you guys have anything in the way of a Mac widget that links to the daily comic?

I know other comics do it.

Exodist
08-30-2007, 12:43 PM
You wanna code it? :tsktsk:

By the way, who is kwanza D:

ne3
08-30-2007, 1:27 PM
Kwanza is like, the one who is taking care of most of the forums coding and such. He also caused the great reset, that's why you should replace him with your fancy codes and all.

Nice idea mate.

Exodist
08-30-2007, 2:56 PM
Would you say he's a site owner, or just a code monkey?

The Fetus
08-30-2007, 2:59 PM
Yes indeed, that would be delightful :mmyes:

Indeed...


WAIT A MINUTE! :pop:

Demoir
08-30-2007, 3:07 PM
Would you say he's a site owner, or just a code monkey?

Hahahaahahah...oh...yeah, basically.

Great idea though.

Hulabalooza
08-30-2007, 3:12 PM
Would you say he's a site owner, or just a code monkey?

Code god monkey, like Hanuman.

Penis_Captivus
08-30-2007, 3:17 PM
I am totally lost

Exodist
08-30-2007, 3:21 PM
Hehe, apperently I got an "Infraction" for this (http://forums.explosm.net/showpost.php?p=52837&postcount=41) post...:wail:

Anyways, if anyone needs help with this, feel free to PM me. Also, please don't PM me if you don't have your own web space that can handle PHP and have ftp access.

Matt
08-30-2007, 3:41 PM
@Matt: Are you an admin :o

Are you fucking kidding me? Lurked for 2 years my ass...

Considering that this task only took me two minutes to complete, minus transferring the images. >_>

Our images are spread across several directories, none of which will be changed. Our pages must stay intact so that linking still works, something your little app doesn't do whatsoever. When I make a random comic button (yes, it's already been planned) it'll run off the database, keep the pages exactly how they are and preserve our directory structure.

Thanks for trying, though. Now back to work I go.

Cristo
08-30-2007, 3:58 PM
Code god monkey, like Hanuman.

Hannuman's stones a Conan fan!

Oh and Exodist btw, I like you already and thanks for the initiative :D

Exodist
08-30-2007, 4:20 PM
Our images are spread across several directories, none of which will be changed. Our pages must stay intact so that linking still works, something your little app doesn't do whatsoever. When I make a random comic button (yes, it's already been planned) it'll run off the database, keep the pages exactly how they are and preserve our directory structure.

I wasn't suggesting about destroying the site's directories and databases. I was actually just suggesting that a new storage be created, under a new sub-domain. Something like http://randomimg.explosm.net
I look forward to your random comic system. (Not sarcastic) :fluffle:


Oh and Exodist btw, I like you already and thanks for the initiative :D
:dance::dance:


Bahahah I love the emotes here :D

Exodist
08-30-2007, 4:31 PM
Hubaloosa, I hate you. (Image is not work safe) (http://farm1.static.flickr.com/166/371259058_27b3f2af65.jpg)
Somebody ban him plz :aaa:
He pm'd me it without a warning D:

Chriz: Grow a pair
Exodist: NO U

StickSpartan
08-31-2007, 6:41 AM
Uh, yeah, Matt already explained everything but, If Matt really thought he needed something I'm pretty sure he could pull code out of his nose rather easily.

Matt
08-31-2007, 2:38 PM
OR MY BUTT

Assassin
08-31-2007, 2:43 PM
OR MY BUTT

If I'm not in it

Exodist
08-31-2007, 9:49 PM
Well this topic has gone to all hell. Lock/Move please?

Killer Carebear
08-31-2007, 9:51 PM
Don't they all?

CrumPoker
09-01-2007, 9:18 AM
Just use the fucking idea and lock this thread. :dance: