X3 Photo Gallery Support Forums

User avatar
X3 Wizard
Topic Author
Posts: 12093
Joined: 30 Sep 2006, 03:37

Files App Config

15 Apr 2020, 05:08

Files app config
External config is now done from config.php located inside your storage_path (normally set to "_files"). If the file does not exist, try running the app once in browser, and _files/config/config.php should get created. If you have set a different storage_path than "_files", you will need to look for the file in your custom storage_path.

Below is an example of a config file with all settings //commented out.  When the options are commented out, it means they are not set, and will instead inherit app defaults. Remove the forwards slashes // to edit a setting.

// Uncomment the parameters you want to edit.
return array (
  //'root' => '',
  //'start_path' => false,
  //'username' => '',
  //'password' => '',
  //'load_images' => true,
  //'load_files_proxy_php' => false,
  //'load_images_max_filesize' => 1000000,
  //'load_svg_max_filesize' => 100000,
  //'image_resize_enabled' => true,
  //'image_resize_cache' => true,
  //'image_resize_dimensions' => 320,
  //'image_resize_dimensions_retina' => 480,
  //'image_resize_quality' => 90,
  //'image_resize_function' => 'imagecopyresampled',
  //'image_resize_min_filesize' => 50000,
  //'image_resize_max_filesize' => 10000000,
  //'image_resize_min_ratio' => 1.5,
  //'image_resize_cache_direct' => false,
  //'menu_enabled' => true,
  //'menu_show' => true,
  //'menu_max_depth' => 5,
  //'menu_sort' => 'name_asc',
  //'menu_cache_validate' => true,
  //'menu_load_all' => false,
  //'layout' => 'rows',
  //'image_cover' => true,
  //'sort' => 'name_asc',
  //'sort_dirs_first' => true,
  //'cache' => true,
  //'cache_key' => 0,
  //'storage_path' => '_files',
  //'files_exclude' => '',
  //'dirs_exclude' => '',
  //'history' => true,
  //'breadcrumbs' => true,
  //'transitions' => true,
  //'click' => 'popup',
  //'code_max_load' => 100000,
  //'code_allow_edit' => false,
  //'popup_interval' => 5000,
  //'topbar_sticky' => 'scroll',
  //'check_updates' => true,
  //'allow_tasks' => NULL,

root // default '' (empty = current dir)
Assigns the root path from where Files app will load files and directories. It can be a relative path or an absolute path.
'root' => '' // same dir as files app file
'root' => 'content' // sub-directory 'content'
'root' => '../' // parent directory
'root' => '/var/user/eddie/' // absolute path from server root

start_path // false (root)
Assign the first directory that loads into view, which by default is the same as root dir. It can be a relative path or an absolute path, but the path must be inside the root dir.
'start_path' => '' // start path is same as root
'start_path' => 'galleries/birds' // custom start path
Add username and password to protect your Files app by login.

Add username and password to protect your Files app by login. Password can be encrypted using this tool

load_images // true
If disabled, images will not be loaded into galleries.

load_files_proxy_php // false
Force images to load via PHP proxy if they can't be accessed by URL (for any reason).

load_images_max_filesize // 1000000 (1MB)
Max image file size to load directly into galleries. If file size exceeds this value, it will be replaced by a file ICON. * Will not affect images that are effectively resized. * The point of this is to prevent massive images from being loaded directly into gallery layouts, causing slow load and sluggish interface.

load_svg_max_filesize // 100000 (100kb)
Max SVG file size to load directly into galleries. If file exceeds this value, it will be replaced by a file  ICON. * The point of this is to prevent complex SVG shapes from slow rendering and causing a sluggish interface.

image_resize_enabled // true
Allows resizing of images loaded into galleries.

image_resize_cache // true
Allow caching of resized images to improve loading speeds. Resized images will normally get cached in your storage_path at _files/cache/images/*.

image_resize_dimensions // 320
Default image resize dimensions. A suitable image width for resized images so they look good in all Files gallery layouts.

image_resize_dimensions_retina // 480
Server larger image resize dimensions for high-density screens (retina). This will cause higher quality images for retina screens, but will ultimately cause your image cache to double in size. Set to false if not required.

image_resize_quality // 90
JPG compression level for resized images.

image_resize_function // imagecopyresampled
PHP image resize function. Choose between imagecopyresampled (smoother) and imagecopyresized (faster). Quality difference is minimal, but imagecopyresampled is higher quality, while imagecopyresized is twice as fast. You can use imagecopyresized for example if you want faster resizing when not using cache. See comparison.

image_resize_min_filesize // 50000 (50kb)
Minimum image file size for resizing. If the file size is lower than this values, it will instead be loaded directly into the gallery, without resizing. It's often pointless to resize images that are already small.

image_resize_max_filesize // 10000000 / 10mb
Maximum image file size for resizing. If the file size is larger than this, the file will not be resized (and likely replaced by an icon). Trying to resize excessively large images will take a very long time, and will often cause PHP memory errors on most servers.

image_resize_min_ratio // 1.5
Minimum ratio difference between image resize target dimensions and original image dimensions. If the original image is only X times larger than the resize target, the original image will be used. In most cases, it's pointless to create a resized version if the original image is only slightly larger than resize target.

image_resize_cache_direct // false
Will attempt to load cached resized images directly into the gallery, bypassing the Files PHP app. May cause faster loading and improved browser caching, since image files are loaded directly into browser. However, if this option is enabled and you delete the image cache, you may end up with missing image files because the Files app is not used to detect if the cached request exists or not. If this option is enabled and you DO delete the image cache, you will need to increase the cache_key setting by +1.

menu_enabled // true
Toggle the left folder menu on or off. You can still navigate folders from within the main view area. * If the root dir doesn't contain any folders, the menu will always be disabled.

menu_show // true
Toggle the left folder menu expanded or collapsed by default. This setting will have no effect if there are no folders in the root dir or if menu is disabled. Also, this value is "remembered" by the browser, and will always default to the last state the menu was in for each browser.

menu_max_depth // 5
As a precaution, the left menu depth is limited to 5 subfolder levels. In many cases, it's unproductive to load an infinite amount of subfolders into the menu, as it will be slow and may not display nicely in the menu interface. You can easily increase this value to a higher amount, but please take note, if you are loading a huge root directory, it could be very slow to load the entire tree. For example, if you are loading the entire root of a server, it would be a massive task to load the entire tree. You can still navigate to deeper folder levels directly from the view area.

menu_sort // name_asc
Choose how to sort folder menu items with options name_asc, name_desc, date_asc, and date_desc.

menu_cache_validate // true
When enabled (default), the menu cache will be validated to make sure it matches the actual folder structure. This mechanism is normally necessary, to make sure any changes you make (new folders etc), are validated vs menu cache file. If disabled, the cache is only validated against root and level-1 folders. It may be useful to disable this feature if you have a persistent Files gallery with a heavy folder structure, in which case the menu will load much faster. Keep in mind, if you do disable this function and then make changes in subfolders, you will need to either delete the menu cache or increase the cache_key value.

menu_load_all // false
Will cause the menu to preload all pages, including all file data. This means that once the menu is loaded, you can navigate all folders instantly, without any loading. This feature is useful for persistent galleries or for simple root folder structures.

layout // rows
Default gallery layout with options list, blocks, grid, rows, and columns. * This value is "remembered" by the browser, and will always default to the last state selected by the visitor.

image_cover // true
Scales images inside their container for some layouts, to fill the entire grid area. Some cropping will occur. * This value is "remembered" by the browser, and will always default to the last state selected by the visitor.

sort // name_asc
Default sort for files in the main view area, with options name, date, filesize and kind. * This value is "remembered" by the browser, and will always default to the last state selected by the visitor.

sort_dirs_first // true
When enabled, will always list dirs at the top, which is usually most intuitive.

cache // true
When enabled, cache will be created for folders and menu. Cache is created in storage_path, normally _files/cache/folders and _files/cache/menu. Disable this option if you don't want Files app to create any cache files, for example if you are only going to use it once and delete. Keep in mind, Files app will load much faster with cache enabled.

cache_key // 0
Menu cache and folders cache is compared vs a cache_key. If you want to force refresh the cache (for any reason), you can increase the cache_key by +1.

storage_path // _files
The storage_path defines where Files app will create cache folders, config and plugins. In most circumstances, you should always stick to default value "_files". In some cases, you might want to use a different storage_path, if you don't want to write data into current dir, or if you have several Files apps that share the same storage_path (and cache).  Storage path can be relative or absolute.

A PHP regex to exclude or include files. Would normally be used to exclude certain file types, or only include some extensions. Applies on the basename of all files. Example:
'files_exclude' => '/\.(pdf|jpe?g)$/i' // exclude all pdf, jpg and jpeg files, case-insensitive.
A PHP regex to exclude directories. Applies on the root relative-path of all directories and files.
'dirs_exclude' => '/\/eleph|\/football(\/|$)/i', // exclude dirs that start with "eleph" and dirs that match /football/ (and everything within).
history // true
With history enabled, browser will change URL ?path/to/folder as you navigate directories. This also allows you to deep-link directly to files and directories when sharing an URL. If disabled, URL will never change when navigating.

breadcrumbs // true
Enables the "breadcrumbs" interface element in the topbar, allowing user to easily navigate to parent directories. If root does not contain any folders, breadcrumbs will always be disabled.

transitions // true
Enables various transitions in the frontend.

click // popup
Choose what method to trigger [popupmodaldownloadwindow or menu] when clicking an item in the main view area. Default value "popup" will apply for all image-files but will fallback to "modal" for non-image files.

code_max_load // 100000 (100kb)
Maximum file size of code files (PHP, JS, CSS etc) to load and display directly in the Files code editor. The  code editor may be sluggish for very large files, and it's not useful to automatically load them into the editor.

code_allow_edit // false
Allow editing of code files directly from the Files app code editor. 

popup_interval // 5000 (5s)
Set interval for the popup slideshow.

topbar_sticky // 'scroll'
Choose how the topbar attaches itself to screen with options true, false and 'scroll'.

check_updates // true
Check for Files app updates. Displays a "bell" icon top right if there is an update to the Files app.

allow_tasks // null
* Not yet documented or available for public.