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
bbcode2html
A post elsewhere got me playing around with the stream...
Richard (chuggerguy)
Links from an undesirable site
I don't know any where else to post this. I need some...
samtom_gw
HTML link test
Does HTML work?
patchyjack
Checking for the presence of adblocker.
Asteroids This post was edited by chuggerguy on Fri,...
Richard (chuggerguy)
Sponsored Products
Traditional Triple Concealed Thermostatic Shower Faucet 2 Outlets
Hudson Reed
DENY Designs Khristian A Howell Sedona Outdoor Throw Pillow - 14423-OTHRP18
$49.00 | Hayneedle
Kids Kendall Chili Blackout Window Curtain Panel
$17.95 | Bellacor
Philips 58" LED Smart TV
$899.00 | FRONTGATE
Indoor Berber Area Rug: Contemporary and Dark Yellow Rectangle 7' 9" x 9' 9" Plu
Home Depot
Distratto Pendant by Trend Lighting
$120.00 | Lumens
Antique Birds Decorative Base Glory Stained Glass Tiffany Table Lamp
ParrotUncle
Adeco Decorative White Wood 'Love' Wall Hanging Collage 4x6 Photo Frame with 9 O
Overstock.com
People viewed this after searching for:
© 2015 Houzz Inc. Houzz® The new way to design your home™