I'm stuck with your Auto Image tutorial.
I have a thumbnails folder created OK but no thumbnails in it and no images displaying.
In the bit in video where you click on the broken image link and the browser address bar has something ending with ".png", mine all say the same thing, "%7Bimage%7D" instead of ".jpg" or ".png" or whatever.
Dunno if that gives any clues?
Anyway, thanks for the videos. I'm just trying to learn this and you provide a great resource.
Cheers,
Robert.
-EDIT-
Here's the code:
<?php if (isset($_GET['img'])) { //make thumbnail if (file_exists($_GET['img'])) { ignore_user_abort(true); set_time_limit(120); ini_set('memory-limit', '512'); $src_size = getimagesize($_GET['img']); echo "aye"; if ($src_size === false) { die ("That is not a photie ya chancer."); } //set thumbnail dimensions $thumb_width = 150; $thumb_height = 150; if ($src_size['mime'] === image/jpeg) { $src = imagecreatefromjpeg($_GET['img']); } else if ($src_size['mime'] === image/gif) { $src = imagecreatefromgif($_GET['img']); } else if ($src_size['mime'] === image/png) { $src = imagecreatefrompng($_GET['img']); } //define aspect ratios using width over height $src_aspect = round(($src_size[0] / $src_size[1]), 1); $thumb_aspect = round(($thumb_width / $thumb_height), 1); //trimming if ($src_aspect < $thumb_aspect) { //too high $new_size = array($thumb_width, ($thumb_width / $src_size[0]) * $src_size[1]); $src_pos = array(0, (($new_size[1] - $thumb_height) * ($src_size[1] / $new_size[1])) / 2); } else if ($src_aspect > $thumb_aspect) { //too wide $new_size = array(($thumb_width / $src_size[1]) * $src_size[0], $thumb_height); $src_pos = array((($new_size[0] - $thumb_width) * ($src_size[1] / $new_size[1])) / 2, 0); } else { //same $new_size = array($thumb_width, $thumb_height); $src_pos = array(0, 0); } if ($new_size[0] < 1) $new_size[0] = 1; if ($new_size[1] < 1) $new_size[1] = 1; $thumb = imagecreatetruecolor($thumb_width, $thumb_height); imagecopyresampled($thumb, $src, 0, 0, $src_pos[0], $src_pos[1], $new_size[0], $new_size[1], $src_size[0], $src_size[1]); if ($src_size['mime'] === image/jpeg) { imagejpeg($thumb, "thumbs/{$_GET['img']}"); } else if ($src_size['mime'] === image/gif) { imagegif($thumb, "thumbs/{$_GET['img']}"); } else if ($src_size['mime'] === image/png) { imagepng($thumb, "thumbs/{$_GET['img']}"); } // header ("Location: thumbs/{$_GET['img']}"); } die(); } else echo "help"; //check to see if thumbnail folder needs to be created if (is_dir('./thumbs') === false) { mkdir('./thumbs', 0744); } //return an array of image files $images = glob('*.{jpg,JPG,jpeg,png,gif}', GLOB_BRACE); ?> <html> <head> <style type = "text/css"> a, img {float: left} </style> <h1>Abel Image Gallery</h1> </head> <body> <div> <?php foreach ($images as $image) { if (file_exists("./thumbs/{$image}")) { echo "<a href=\"{image}\"><img src=\"thumbs/{$image}\" alt=\"{$image}\" /></a>"; } else { echo "<a href=\"{image}\"><img src=\"?img={$image}\" alt=\"{$image}\" /></a>"; } } ?> </div> </body> </html>