drewtheman Posted June 18, 2007 Share Posted June 18, 2007 Please help! I am using a simple gallery script that allows me to create thumbnails based on the jpegs ina specified folder. The script even includes a variable to change in order to control the amount of columns. This is great for a few pictures, but what code would I need if there were hundreds and I only wanted only 15-20 thumbnails with a 'next' and 'prev' links to view more? Here is my current code: <?php $images = "photos/"; # Location of small versions $big = "big/"; # Location of big versions (assumed to be a subdir of above) $cols = 4; # Number of columns to display if ($handle = opendir($images)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != rtrim($big,"/")) { $files[] = $file; } } closedir($handle); } $colCtr = 0; echo '<table width="10%" cellspacing="3"><tr>'; foreach($files as $file) { if($colCtr %$cols == 0) echo '</tr><tr><td colspan="2"></td></tr><tr>'; echo '<td align="center"><a href="' . $images . $file . '"><img src="' . $images . $file . '" / width=70 height=50 border=0></a></td>'; $colCtr++; } echo '</table>' . "\r\n"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/56082-pagination-with-photo-thumbnails/ Share on other sites More sharing options...
B34ST Posted June 18, 2007 Share Posted June 18, 2007 take a look at the pagination tutorial on this site it shoulf help you out Quote Link to comment https://forums.phpfreaks.com/topic/56082-pagination-with-photo-thumbnails/#findComment-276977 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.