Panel Handling many images - Super Slow

Hi,

I was wondering if there’s any kind of tweaking when accessing a subpage with many files, by many i mean 400+ images the subpage loading times is horrendously slow, while frontend can archive all sorts of methods to sort or limit.

What’s the best way to handle it?
I know I could split to more subfolders, but is there any other way?

The Panel paginates the file collection, does that not work for you?

what means paginates… i guess it doesn’t.

when calling the subpage with alot of pictures it’s showing me an endless list of files, such as if i were to have 300 pictures, it’s showing them all without pagination. thus accessing that page will lead to increased loading times, on 300 images, to page loads for at least 10 seconds on localhost (you see that loading bar at the top of the screen go quite slow)

kirby 2.4.0
no panel “file” options except for files: true

With a few thousand photos in several subfolders even on frontend it gets a bit slow if won’t sub-sort them even further such as

album 1 => thousands of photos
album 2 => thousands of photos
album 3 => thousands of photos

vs

album 1

  • sub album => 1/3 of thousands
  • sub album => 1/3 of thousands
  • sub album => 1/3 of thousands
    album 2
  • sub album => 1/3 of thousands
  • sub album => 1/3 of thousands
  • sub album => 1/3 of thousands
    …
    …

basically:

foreach($page->children()->visible()->image() as $image){
//  do something here
}

is very sluggish compared to having the way with more subfolders:

foreach($page->grandChildren()->visible()->image() as $image){
//  do something here
}

Oh to mention on frontend … My task which i was trying to archive ( which i did successfully but slow ) was to have a subpage with 300+ photos, I was calling exif data to get the original date when the image was shot, and then proceed to sort it by hour echoing a link for each hour.

Loading times frontend on localhost have varied from 1-5 seconds generally speaking to sort. while in each hour-suburl it was echoing all images (smaller thumb versions as an img) paginated with 30 images per page. Which also felt somewhat sluggish.

i create a page for a photoagency once. they had like 500 images per folder. my suggestions for you.

frontend:

backend:

  • dont know much about panels caching but 1k images seems a but much for one page object to handle
  • you could try to hack panel/controllers/files.php >> thumb() function to display smaller or more compressed (or blured) thumb images. thus speeding up the backend thumbs generation.

i were to upload though ftp as i’d work with about 4000 to 5000 images within several subpages at once so uploading and resize on panel hooks is not the best alternative.

i am already using lazyload to optimize loading times.

i might give json/caching a try when i get the chance, for the time being i’ll stay on my workaround with a few more subdirectories i guess.

for future reference all suggestions are welcome.

you could also hack the panel to use the [kirby root]/thumbs folder not the [kirby root]/panel/thumbs.