Levertine

Please login or register.

Author Topic: lgal_items Server file?  (Read 1790 times)

lurk

  • Full Member
  • ***
  • Posts: 113

lgal_items Server file?
« on: January 12, 2015, 09:21:44 PM »
OK just out of curiosity, how does the file file system work, on the server I mean.

Reason I ask, Added one album, and then bulk uploaded 8 files to it.  On the server it shows in the directory lgal_items no albums show in the albums folder, just a ".htaccess" file.  And in the files folder it has 8 folders and inside another folder containing the three files for each item.

Now I deleted the items in the gallery side menu, and the folders are still on the server, each one with another empty folder inside.  Items have gone as expected, but empty files are still there.

Guitarist Guild Running SMF 2.0.9 / Tinyportal 1.1 and Levertine Gallery

Arantor

  • Levertine Developer
  • Full Member
  • *
  • Posts: 248

Re: lgal_items Server file?
« Reply #1 on: January 12, 2015, 09:28:23 PM »
OK, so lgal_items contains the physical files, while all the information about those files lives in the database.

lgal_items/albums contains the thumbnails for albums if you upload thumbnails for albums; if you use any of the stock covers for albums, no files will live in there.

lgal_items/files contains the actual files for the gallery. Up to 3 files per item, can be as little as 1 (or in some cases none actually), for any uploaded file, you will have the file and possibly a preview image (up to 500px square) and a thumbnail image (up to 125px square). Not all file types generate previews or thumbnails and may use the bundled images (e.g. when you see the zip file icon in the LevGal downloads album, that's the bundled icon for zip files)

The structure of the folders is set up based on a hash made from the file - to prevent the filename being guessable (and subject to certain types of attack if the system happens to end up compromised in certain ways) a hash is made of the file, sort of like a mostly unique reference number for it. This hash is used not only for the filename but also the folder the file will be in.

A jpg file, whose id is 1 (first time you upload) might get a hash of 123456 (it won't, it will be longer and contain 0-9 and a-f because it's hex). But let's say it did. This would end up in the filesystem as 1_123456_jpg.dat and because the hash begins with 12, it will be in 1/12/ as a folder.

This might seem weird to split the folders like that, and end up with 16 folders each containing up to 16 folders (because it's hex), meaning 256 folders in theory but there's a reason: FTP. A lot of hosts limit FTP which means backups are awkward to prepare and once you go above a couple of thousand files in a folder things start to go weird anyway. LevGal mitigates these by automatically spreading files between folders on a relatively equal basis without you having to worry about how it works - it 'just does' :D

lurk

  • Full Member
  • ***
  • Posts: 113

Re: lgal_items Server file?
« Reply #2 on: January 13, 2015, 09:40:00 AM »
Thanks for the explanation. It's slowly sinking in, takes a while at my age you know. lol..   :-[

I was checking this out while trying to find out why a couple of PNG test images were not showing in the preview or item page, but the thumb image were showing.  Still not sure why this is happening tbh.  Might be my Xampp setup, using GD instead of ImageMagick.  I'll try one on my live site and see what happens, and report back.

EDIT: Yep it works fine on my live site.  ;)
« Last Edit: January 13, 2015, 09:48:18 AM by lurk »
Guitarist Guild Running SMF 2.0.9 / Tinyportal 1.1 and Levertine Gallery

Arantor

  • Levertine Developer
  • Full Member
  • *
  • Posts: 248

Re: lgal_items Server file?
« Reply #3 on: January 13, 2015, 02:27:52 PM »
There should be no difference between the two in theory since I built ImageMagick after GD support, so I don't think that's it.

Anything in the error log? How big are the pictures (in both pixel and file size)?

lurk

  • Full Member
  • ***
  • Posts: 113

Re: lgal_items Server file?
« Reply #4 on: January 13, 2015, 03:30:48 PM »
There should be no difference between the two in theory since I built ImageMagick after GD support, so I don't think that's it.

Anything in the error log? How big are the pictures (in both pixel and file size)?

Nothing error log at all.  It was only a old PNG banner 468 x 130 which I had sitting in my images folder, thought I'd try it as a test.  Works fine on my live site, but in Xampp only the thumbnail shows, and the normal image is missing.

This is the image 

Guitarist Guild Running SMF 2.0.9 / Tinyportal 1.1 and Levertine Gallery

Arantor

  • Levertine Developer
  • Full Member
  • *
  • Posts: 248

Re: lgal_items Server file?
« Reply #5 on: January 13, 2015, 04:15:59 PM »
Odd, really odd. I'll experiment and see if I can't reproduce - since I'm using GD locally too as I couldn't get ImageMagick to behave properly.

Arantor

  • Levertine Developer
  • Full Member
  • *
  • Posts: 248

Re: lgal_items Server file?
« Reply #6 on: January 21, 2015, 02:11:02 AM »
I think this was actually fixed in the midst of the stuff around the image preview changes with GIF files (since this was a related bug). If this recurs, I'll investigate.
 

SMF 2.0.9 | SMF © 2014, Simple Machines
BlueLight design by Bloc