Auto thumbs image gallery
Posted: Thu Sep 19, 2013 4:10 am
Hi
Some time ago, on your youtube site there was an auto image gallery tutorial. I decided to give it a try. My first attempt was on windows. Since then i have migrated to Linux and have found that this script does not work. So, i started from the beginning and this is where i am up to
page. Having noticed that the "?img=" does not appear in the url i added it, eg ?img=picture.jpg but still nothing displays.
I can not see anything that is wrong with my code, hopefully another set of eyes will help
Thanks in advance for you help
Some time ago, on your youtube site there was an auto image gallery tutorial. I decided to give it a try. My first attempt was on windows. Since then i have migrated to Linux and have found that this script does not work. So, i started from the beginning and this is where i am up to
<?php if (isset($_GET['img'])){ if (file_exists($_GET['img'])){ ignore_user_abort(true); set_time_limit(120); ini_set('memory_limit', '512M'); $src_size = getimagesize($_GET['img']); if ($src_size === false){ die('Not an Image.'); } $thumb_width = 250; $thumb_height = 200; print_r($src_size); } die(); } if (is_dir('./thumbs') === false){ mkdir('./thumbs', 0744); } $images = glob('*.{jpg,jpeg,png,gif}', GLOB_BRACE); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> a, img {float:left;} </style> </head> <body> <div> <?php foreach($images as $image){ if (file_exists("./thumbs/{$image}")){ echo "<a href=\"\"><img src=\"thumbs/{$image}\" alt=\"{$image}\" /></a>"; }else{ echo "<a href=\"\"><img src=\"?img={$image}\" alt=\"{$image}\" /></a>"; } } ?> </div> <body> </html>According to the vid the output of the print_r($src_size); returns an array of the image, well that does not happen, i just get a blank
page. Having noticed that the "?img=" does not appear in the url i added it, eg ?img=picture.jpg but still nothing displays.
I can not see anything that is wrong with my code, hopefully another set of eyes will help
Thanks in advance for you help