I did one a while ago that would allow upload and then take all images and create a page showing them using the GD library, dunno if it'll help but here it is:
-----------------gallery.php-------------------------
<?php
// made by Karv copyright him and the ones he ripped some code off
// cheers peeps - abuse this code as you like and feel free to name me in it

function getimgArray($dir,$sort='asort')
{
if ( is_dir($dir) ) {
$fd = @opendir($dir);
while ( ($part = @readdir($fd)) == TRUE ) {
clearstatcache();
if ($part != "." && $part != ".." && (ereg("\\.jpg\$",$part) || ereg("\\.JPG\$",$part))) { // unix is picky, ok?
$dir_array[] = $part;
}
}
if($fd == TRUE) {
closedir($fd);
}
if (is_array($dir_array)) {
$sort($dir_array);
$dir_file_count = count($dir_array);
Return $dir_array;
} else {
Return FALSE;
}
} else {
Return FALSE;
}
}
// sort out whats goin on
$file_array = getimgArray('.','asort'); //set directory and sort type here
$i=1;
// check we have stuff to play with
if (!empty($file_array)) {
echo "<body bgcolor=black>";
echo "<div align=\"center\"><table border=0 width=90% cellpadding=0 cellspacing=0><tr>";
foreach ($file_array as $file_name) {
$textfile="$file_name.txt";
//see if we are making left or right cells
if ($i%5) {
echo "<td>";
echo "<div align=\"center\"><a href=$file_name><img src=\"image.php?file_name=$file_name\" border=3 alt=\"";
if (file_exists($textfile)){
include($textfile);
}else{
echo "Picture no. $i";
}
echo "\"></div></a></td>";
} else {
// pic 5
echo "<td>";
echo "<div align=\"center\"><a href=$file_name><img src=\"image.php?file_name=$file_name\" border=3 alt=\"";
if (file_exists($textfile)){
include($textfile);
}else{
echo "Picture no. $i";
}
echo "\"></div></a>";
echo "</td></tr><tr>";
}
$i++;
}
} else {
// no piccies
echo "no piccies in the directory";
}
echo "</table></div>";
unset($idx);
?>
<!-- write a form for uploading piccies and captions -->
<div align="center">
<form enctype="multipart/form-data" action="uploaded.php" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<div align="center">Upload a piccy<br>Caption<input type="text" name="caption">
<input type="hidden" name="MAX_FILE_SIZE" value="150000">
<input type=hidden name=return_where value="virtualkev_old">
<input type=hidden name=return_to value="3_test.phtml">
File:<input name="userfile" type="file">
<input type="submit" value="Send File" name="submit">
</div>
</td>
</tr>
</table>
</form>
</div>
-------------------image.php--------------------------
<?php
$src_img = ImageCreateFromJPEG($file_name);
/* desired width of the thumbnail */
$picsize = 100;
/* grabs the height and width */
$new_w = imagesx($src_img);
$new_h = imagesy($src_img);
/* calculates aspect ratio */
$aspect_ratio = $new_h / $new_w;
/* sets new size */
$new_w = $picsize;
//$new_h = abs($new_w * $aspect_ratio);
$new_h = 120;
/* creates new image of that size */
$dst_img = ImageCreate($new_w,$new_h);
/* copies resized portion of original image into new image */
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imageJPEG($dst_img);
ImageDestroy($dst_img);
?>
-------------------------------------
Oh btw it stores textfiles for captions too, if there isnt a textfile it'll just say "picture no#".
Have fun. ***************************************
Party on, dudes!
![[cannon] [cannon] [cannon]](/data/assets/smilies/cannon.gif)