Jump to content

Limit Output


Bricktop

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.