Random Images

Richard (chuggerguy)September 9, 2012
Thank you for reporting this comment. Undo
Richard (chuggerguy)

This post was edited by chuggerguy on Tue, Jan 29, 13 at 18:28

    Bookmark   September 9, 2012 at 3:11PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Posting the above resulted in braces being changed to parenthesis. So... one more time:

<?php

if ($dh = opendir('./images')) "
$files = array();
while (($file = readdir($dh)) !== false) "
if ($file !== "." && $file !== ".." && $file !== "index.html") "

array_push($files, $file);
>
>
closedir($dh);
>

$index = array_rand($files);
$extension = pathinfo($files[$index]);
$extension = $extension['extension'];

if ( $extension == "jpg" ) "
header("Content-type: image/jpeg");
imagejpeg(imagecreatefromjpeg("images/".$files[$index]));
>

if ( $extension == "png" ) "
header("Content-type: image/png");
imagepng(imagecreatefrompng("images/".$files[$index]));
>

if ( $extension == "gif" ) "
header("Content-type: image/gif");
echo file_get_contents("images/".$files[$index]);
>

if ( $extension == "bmp" ) "
header("Content-type: image/bmp");
imagebmp(imagecreatefrombmp("images/".$files[$index]));
>

?>

    Bookmark   September 9, 2012 at 4:23PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Again, posted is not equal to previewed so... one more time:

<?php

if ($dh = opendir('./images')) "
$files = array();
while (($file = readdir($dh)) !== false) "
if ($file !== "." && $file !== ".." && $file !== "index.html") "

array_push($files, $file);
>
>
closedir($dh);
>

$index = array_rand($files);
$extension = pathinfo($files[$index]);
$extension = $extension['extension'];

if ( $extension == "jpg" ) "
header("Content-type: image/jpeg");
imagejpeg(imagecreatefromjpeg("images/".$files[$index]));
>

if ( $extension == "png" ) "
header("Content-type: image/png");
imagepng(imagecreatefrompng("images/".$files[$index]));
>

if ( $extension == "gif" ) "
header("Content-type: image/gif");
echo file_get_contents("images/".$files[$index]);
>

if ( $extension == "bmp" ) "
header("Content-type: image/bmp");
imagebmp(imagecreatefrombmp("images/".$files[$index]));
>

?>

    Bookmark   September 9, 2012 at 4:27PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Well... the heck with it. :)

    Bookmark   September 9, 2012 at 4:32PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

A simple upload script to place images in the image directory.
Probably rough, I'm no programmer. It seems to work though.

    Bookmark   September 10, 2012 at 2:56AM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Random song:

    Bookmark   September 11, 2012 at 2:36AM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Because of the way "header" works, that opening php tag absolutely has to be on the very first line, very first character.

I kinda knew, but kinda didn't. I just had to debug because I had added a blank line at the top and pushed it one character right to make it easier to do an area screen capture. :)

    Bookmark   September 12, 2012 at 5:40PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Your browser does not support the video tag.

    Bookmark   September 13, 2012 at 7:44AM
Thank you for reporting this comment. Undo
Richard (chuggerguy)
    Bookmark   October 12, 2012 at 9:12PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)
    Bookmark   November 9, 2012 at 11:55PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

This post was edited by chuggerguy on Sat, Dec 29, 12 at 21:23

    Bookmark   December 17, 2012 at 3:06AM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Vertical bars turn into semi-colons when posted.
: \:
'\'
:
:

This post was edited by chuggerguy on Fri, Dec 28, 12 at 23:42

    Bookmark   December 26, 2012 at 1:32AM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Vertical bar.

&#124;

This post was edited by chuggerguy on Thu, Dec 27, 12 at 20:22

    Bookmark   December 27, 2012 at 8:18PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Go here.

This post was edited by chuggerguy on Tue, Apr 16, 13 at 19:48

    Bookmark   December 27, 2012 at 8:25PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

video converter

Video is not visible, most likely your browser does not support HTML5 video

This post was edited by chuggerguy on Sun, Jan 13, 13 at 20:19

    Bookmark   January 7, 2013 at 1:40AM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

link in subject?

    Bookmark   January 31, 2013 at 2:07AM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

That should probably be guarded against, at least if it works the same for the title of the original post. There would be no way for the average user to even click into the thread, no way to reply, no way it would ever sink. Maybe it wouldn't work like that in the main title, still... I would be afraid to try it to find out. :)

This post was edited by chuggerguy on Thu, Jan 31, 13 at 2:36

    Bookmark   January 31, 2013 at 2:15AM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Testing red subject line.

    Bookmark   February 1, 2013 at 10:28PM
Thank you for reporting this comment. Undo
Richard (chuggerguy)

Rotating smiley.

    Bookmark   March 12, 2013 at 1:40AM
Sign Up to comment
More Discussions
Cloud Computing
What is the Advantages of Cloud Computing ?
Tinaustin
Marble Countertop Help!!
Hi, I have recently decided to purchase a spec home...
monikaxp
Html Tag
What is the difference between strong and b tag? This...
puneetchauhan
How to embed animated Gifs onto GW?
I tried posting the way chuggeryguy which worked for...
ladyrose65
People viewed this after searching for:
© 2015 Houzz Inc. Houzz® The new way to design your home™