Bricktop Posted January 13, 2009 Share Posted January 13, 2009 Hi all, I'm not sure if this is possible but I'll explain my problem and see if anyone out there knows how to get round it! I have a custom built gallery using JCarousel to display the thumbnails. The thumbnails are populated by reading from the MySQL database. This works fine but the gallery has grown to such a size (200+ pictures at the moment) that when a user clicks on the Gllery page, it takes an absolute age to load (the thumbnails are all resized to 100 x 100 and are small in size but even so the page takes ages to load). Currently I have a full-page DIV with a "Please wait for the Gallery to load" message appear until the gallery has finished populating the thumbnails but it's just going to take longer and longer the more images are added. My question is this; is it possible somehow to only show the last 20 (for example) thumbnails, and when a user gets to thumbnail 20 in the JCarousel the next 20 automatically load? Like I said, not sure if this is possible but if anyone knows how to do this then that would be great! Thanks Link to comment https://forums.phpfreaks.com/topic/140650-limit-output/ Share on other sites More sharing options...
gevans Posted January 13, 2009 Share Posted January 13, 2009 Your looking for pagination, phpfreaks has a tutorial on it pagination Link to comment https://forums.phpfreaks.com/topic/140650-limit-output/#findComment-736075 Share on other sites More sharing options...
Bricktop Posted January 13, 2009 Author Share Posted January 13, 2009 Thanks for the reply gevans, I didn't think about Pagination! I'll investigate this further - thanks again. Link to comment https://forums.phpfreaks.com/topic/140650-limit-output/#findComment-736076 Share on other sites More sharing options...
Bricktop Posted January 13, 2009 Author Share Posted January 13, 2009 I'm now not sure I can achieve this effect with standard Pagination. I have my own Pagination script I wrote a while back and trying to implement it into JCarousel seems to be a no-go. Essentially, I have some very simple code which builds the Carousel: function populatecarousel() { $sql = mysql_query("SELECT * FROM gallery ORDER BY id DESC"); while ($a = mysql_fetch_array($sql)) { $content .= '<li><a href="'.$a['fullimagepath'].''.$a['imagename'].'" onclick="showPicture(this); return false;" alt="'.$a[description]).'"><img src="'.$a['thumbnailpath'].''.$a['imagename'].'" alt="'.$a[description].'" /></a></li>'; } echo $content; } This is where JCarousel gets the thumbnail images to populate the Image Carousel. Basically, I would like only the first 6 images to be displayed when the Gallery page initially loads, and then each time a user clicks the "Next" button (which JCarousel automatically creates when the page loads) the next 6 images get loaded and so on. I doubt this is possible without some serious Javascript modifications (I'm a total newbie when it comes to JS) - but if anyone knows if this can be achieved with PHP then I'd be greatful of any advice. Thanks Link to comment https://forums.phpfreaks.com/topic/140650-limit-output/#findComment-736094 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.