Skip to main content

Files Gallery 0.2.0

· 5 min read
Karl Ward

This Files Gallery update introduces tons of improvements!

See demoRelease info for Files Gallery version 0.2.0

As requested, we have now added support for symlinks (shortcuts) in Files Gallery. This is a very useful feature, which allows Files Gallery to read content from multiple unique directories. Support for symlinks is enabled by default, but can be disabled from new option allow_symlinks. Also find new option menu_recursive_symlinks which allows subdirs of symlinks in the menu menu *may cause menu loops or duplicate menu items, depending on your folder structure. See symlinks demo.

Windows server support

Files Gallery now works flawlessly also on Windows OS based servers which may use \backslashes in directory paths. Tested on Windows using Laragon server see forum.

EXIF Image Orientation

Images with orientation stored in EXIF will now display correctly rotated in popup and modal, while resized images are correctly rotated according to image EXIF orientation (see forum and exif demo).

Scrollbar UI design

New unobtrusive scrollbar designs that match the Files Gallery design. Menu overflow scrollbar now only appears on mouse hover, and scrollbar is temporarily removed when opening popup.

Extensive mime type mapping

Mime type is used to detect the type of file (image, video, text etc) so that Files Gallery knows what to do with it. Instead of extracting on server (PHP), file mime-type is now mapped from file extension, which is much faster. We use an extensive list of file extensions correctly mapped to mime type, which solves issues with misconfigured servers returning incorrect or missing mime types (forum). New option get_mime_type will force server (PHP) to extract file mime types. This is slower, but more accurate if your files have extensions that don't match the actual file type.

CSS variables

Files Gallery now uses CSS variables (works in all modern browsers), which allow great flexibility for those who want to customize advanced layout/design features. CSS variables can be assigned from _files/css/custom.css. The following variables were added:

_files/css/custom.css
:root {
--strong-color: seagreen;
--sidebar-width: calc(10vw + 180px);
--sidebar-width-small: 85vw;
--sidebar-width-hover: 480px;
--row-height: 100px;
--row-large-height: 160px;
--columns-width: 160px;
--grid-small: 100px;
--grid-large: 158px;
}

Resizer improvements

  • New option enabled by default image_resize_sharpen creates sharper preview images.
  • New option image_resize_memory_limit temporarily increases PHP memory limit if required when resizing large images. Default value is set to 128 MB, which allows resizing images up to ~ 6000 px. If your PHP memory_limit is already higher than this value, it will have no effect.
  • New option image_resize_max_pixels sets the maximum allowed dimensions for resizing images. Default value is set to 30000000 (30 megapixels), which allows resizing images equivalent to 6000 x 5000 px. _* This option is in place to protect server from attempting to resize images beyond capabilities and/or slow performance.__
  • Both image_resize_memory_limit and image_resize_max_pixels are now used to estimate which images are too large to be resized.

Various improvements

  • New indicator for forbidden (unreadable) files and folders in list and menu. Forbidden images don't attempt to load preview image and won't attempt to open in popup. * See forbidden example in demo > tests > forbidden.
  • Added download-button in popup for touch/mobile devices (forum). This works in most modern mobile devices that support the download attribute, although in iOS Chrome browser it currently opens image in browser instead of downloading.
  • New option show_hidden_files allows Files Gallery to show hidden/system files (normally files that start with a .dot like .htaccess).
  • New option context_menu set to false disables context-menu button and right-click menu (forum).
  • New option prevent_right_click blocks browser right-click menu to prevent easily downloading images (forum)
  • Files Gallery will now update user config file (normally _files/config/config.php) with new options after updating. Code viewer can now view/edit empty text files and .htaccess files.
  • Improved error-reporting and all requests (images, json, html) now include memory usage and request time in response headers.
  • Upgraded to new Bootstrap 5. Files Gallery will be using more features from Bootstrap 5 in future releases.
  • Updated several external Javascripts.

Bug fixes

  • Fixed sidebar toggle-expand button for mobile/touch devices.
  • Files Gallery now works without PHP EXIF extension, although with reduced functionality.
  • Can now edit .htaccess and empty text files (when code_allow_edit option is enabled).
  • Fixed so that Files Gallery still works when JSON mime-type is incorrectly set to "text/plain".
  • Fixed url paths when current folder is same as document root.
  • Fixed a bug where top right context-menu button in popup was not updating after navigating to next image.

How to update?

Simply update directly from the "bell" icon top right of Files Gallery or download latest index.php. * All your custom config will remain in tact as long as you are adding your config to _files/config/config.php.