Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
mjau-mjau
X3 Wizard
Topic Author
Posts: 13993
Joined: 30 Sep 2006, 03:37

Files App Config

15 Apr 2020, 05:08

Config docs
See official configuration documentation on our website:
www.files.gallery/docs/config/

---

New options added on 08. Nov 2021 for Files App release 0.3.0.

Files app config
External config is done from _files/config/config.php located inside your storage_path. 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.

Can I edit config options directly in index.php?
Yes, but if you edit index.php directly, your config will be lost if you upgrade to newer versions.


_files/config/config.php
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.
Code
<?php 

// 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_dimensions_allowed' => '',
  //'image_resize_types' => 'jpeg, png, gif, webp, bmp',
  //'image_resize_quality' => 85,
  //'image_resize_function' => 'imagecopyresampled',
  //'image_resize_sharpen' => true,
  //'image_resize_memory_limit' => 128,
  //'image_resize_max_pixels' => 30000000,
  //'image_resize_min_ratio' => 1.5,
  //'image_resize_cache_direct' => false,
  //'folder_preview_image' => true,
  //'folder_preview_default' => '_filespreview.jpg',
  //'menu_enabled' => true,
  //'menu_show' => true,
  //'menu_max_depth' => 5,
  //'menu_sort' => 'name_asc',
  //'menu_cache_validate' => true,
  //'menu_load_all' => false,
  //'menu_recursive_symlinks' => true,
  //'layout' => 'rows',
  //'sort' => 'name_asc',
  //'sort_dirs_first' => true,
  //'cache' => true,
  //'cache_key' => 0,
  //'storage_path' => '_files',
  //'files_exclude' => '',
  //'dirs_exclude' => '',
  //'allow_symlinks' => true,
  //'history' => true,
  //'breadcrumbs' => true,
  //'transitions' => true,
  //'click' => 'popup',
  //'click_window' => '',
  //'click_window_popup' => true,
  //'code_max_load' => 100000,
  //'topbar_sticky' => 'scroll',
  //'check_updates' => false,
  //'allow_tasks' => false,
  //'get_mime_type' => false,
  //'context_menu' => true,
  //'prevent_right_click' => false,
  //'license_key' => '',
  //'filter_live' => true,
  //'filter_props' => 'name, filetype, mime, features, title',
  //'download_dir' => 'zip',
  //'download_dir_cache' => 'dir',
  //'allow_upload' => false,
  //'allow_delete' => false,
  //'allow_rename' => false,
  //'allow_new_folder' => false,
  //'allow_new_file' => false,
  //'allow_duplicate' => false,
  //'allow_text_edit' => false,
  //'demo_mode' => false,
  //'upload_allowed_file_types' => '',
  //'upload_max_filesize' => 0,
  //'upload_note' => '',
  //'upload_exists' => 'increment',
  //'popup_video' => true,
  //'popup_transition' => 'glide',
  //'popup_transition_play' => 'inherit',
  //'popup_interval' => 5000,
  //'popup_caption' => true,
  //'popup_caption_hide' => true,
  //'popup_caption_style' => 'block',
  //'popup_caption_align' => 'center-left',
  //'video_thumbs' => true,
  //'video_ffmpeg_path' => 'ffmpeg',
  //'video_autoplay' => true,
  //'lang_default' => 'en',
  //'lang_auto' => true,
  //'lang_menu' => false,
);
OPTIONS OVERVIEW
---

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.
Code
'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.
Code
'start_path' => '' // start path is same as root
'start_path' => 'galleries/birds' // custom start path
username
Add username and password to protect your Files app by login.

password
Add username and password to protect your Files app by login. Password can be encrypted using this tool:
www.files.gallery/tools/hash

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_dimensions_allowed // ''
Comma-separated list of allowed resize dimensions, in addition to two defaults. Not use directly in Files app, but useful if you want to configure additional image sizes for apps that use Files, like Embed. For example '640, 800, 1024'.

image_resize_types // 'jpeg, png, gif, webp, bmp'
Commma-separated list of image types to resize. Useful for example if you want to exclude PNG/GIF to retain transparency and animations.

image_resize_quality // 85
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_sharpen // true
Creates sharper (less blurry) preview images.

image_resize_memory_limit // 128
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.

image_resize_max_pixels // 30000000
Sets the maximum allowed dimensions for resizing images. Default value is 30000000 (30 megapixels), which allows resizing images up to approximately 6000 x 5000 px. This option is in place to protect server from attempting to resize image sizes beyond capabilities and/or to prevent slow performance.

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.

folder_preview_image // true
Display preview images on folders.

folder_preview_default // '_filespreview.jpg'
Always prioritize this file as folder preview image, if it exists. Useful if you want to assign a specific image for some/all folders, or if you want to assign hidden preview images, or if you simply want to avoid the performance hit of searching each dir for first image to use as preview.

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.

menu_recursive_symlinks // true
List sub-directories of symlinks in the main menu. May cause harmless menu loops and/or duplicate menu items.

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.

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.

files_exclude
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:
Code
'files_exclude' => '/\.(pdf|jpe?g)$/i' // exclude all pdf, jpg and jpeg files, case-insensitive.
dirs_exclude
A PHP regex to exclude directories. Applies on the root relative-path of all directories and files.
Code
'dirs_exclude' => '/\/eleph|\/football(\/|$)/i', // exclude dirs that start with "eleph" and dirs that match /football/ (and everything within).
allow_symlinks // true
Allows Files app to display and follow symlinks in both the list and menu.

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.

click_window // ''
Comma-separated list of file extension that you want to open directly in new window on click. Useful for easy viewing of PDF, HTML and text files, instead of opening a preview in Files app first.

click_window_popup // true
Opens new windows as 'popup' instead of new tab. Useful when opening and viewing PDF, HTML and text type documents. * Does not apply for mobile devices, which will mostly open in new window as normal.

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.

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

check_updates // false
Check for Files app updates. Displays a "bell" icon top right if there is an update available, allowing you to "update", "download" or "read more".

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

get_mime_type // false
Set to true to get file mime type from server (slow) instead of from extension (fast). This should not be necessary, unless you have many files without correct file extensions, or if you want to validate file types on server for security reasons.

context_menu // true
Set to false to disable context-menu button and right-click menu.

prevent_right_click // false
Set to false to block browser right-click menu on sensitive items (images, list items, menu).

license_key // ''
Insert license key here to prevent license popup and unlock features.

filter_live // true
Live search filtering on keyboard input. If disabled, input filtering requires "return" or unfocus to trigger. Useful if you have 1000s of files in folders. * Does not apply for mobile devices, which allways triggers on "search" or keyboard-hide.

filter_props // 'name, filetype, mime, features, title'
File properties to use when filtering. More properties means slower processing. Available properties: name, filetype, mime, features, title, headline, description, creator, credit, copyright, keywords, city, sub-location, province-state.

download_dir // 'zip' / 'files' / '' false
Adds a button to download all files in dir as zip. Optionally, set to 'files' for batch multi-file download (useful, but only works on desktop). Disable by setting to '' (empty) or false.

download_dir_cache // 'dir' / 'storage' / '' /
Enable caching of created ZIP files in each dir (recommended). If disabled, ZIP files will need to get created on-the-fly for every download-click, which can be slow if there many files to zip. By default, zip file will get stored in each dir (most effective option). If you don't want to affect your folders, set to 'storage' to store the zip files inside _files/zip/*.

allow_upload // false
Allow upload files.

allow_delete // false
Allow delete files.

allow_rename // false
Allow rename files.

allow_new_folder // false
Allow create new folders.

allow_new_file // false
Allow create new files.

allow_duplicate // false
Allow duplicating files.

allow_text_edit // false
Allow editing text / code files.

demo_mode // false
When enabled, all filemanager operations will be blocked. Mainly used for the Files app demo.

upload_allowed_file_types // ''
Comma-separated list of file types allowed to upload. When set to empty (default), all file types are allowed. Items can be extension or mime-type with partial match, for example 'pdf, dog, image/*'.

upload_max_filesize // 0
Sets the maximum file size for uploads. 0 means 'unlimited', but file size will always be limited by your PHP upload_max_filesize.

upload_note // ''
Include a small text note at bottom of uploader. For example 'Max file size %upload_max_filesize%'.

upload_exists // 'increment'
Decides what to do if uploaded filename already exists in upload target folder. 'increment' (default) will rename the uploaded file so that it does not overwrite existing filename. For example 'filename.jpg' will become 'filename-2.jpg'. 'overwrite' will simply overwrite existing files with same file name, while 'fail' will cause the uploaded file to fail if same file name exists.

popup_video // true
Opens video formats in the popup (instead of modal).

popup_transition // 'glide'
Assign popup transition style: none, slide, glide, fade, zoom, pop, elastic.

popup_transition_play // 'inherit'
Assign popup transition style when in slideshow "play" mode. Default 'inherit' will use same transition as popup_transition option.

popup_interval // 5000
Set interval in milliseconds between slides in popup "play" mode.

popup_caption // true
Display popup caption, created from various file properties.

popup_caption_hide // true
Autohide popup caption after a few seconds without user interaction.

popup_caption_style // 'block'
Assign popup caption style: block, box, gradient, topbar, none.

popup_caption_align // 'center-left'
Popup caption alignment left, center-left, center or right.

video_thumbs // true
Create thumbnails for video files. Requires FFmpeg and PHP exec().

video_ffmpeg_path // 'ffmpeg'
Path to FFmpeg for video thumbnail creation. Normally just 'ffmpeg', but some servers require a full path to the ffmpeg application

video_autoplay // true
Autoplay videos on click to open.

lang_default // 'en'
Default interface language if browser-language is not supported og `lang_auto` is disabled.

lang_auto // true
Automatically assign interface languages based on detected browser language.

lang_menu // false
Display a dropdown menu in topbar for language selection
 
User avatar
mjau-mjau
X3 Wizard
Topic Author
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Files App Config

26 Aug 2020, 06:15

26. August 2020
Files app release 0.2.0

Added options:
image_resize_sharpen // true
Creates sharper (less blurry) preview images.

image_resize_memory_limit // 128
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.

image_resize_max_pixels // 30000000
Sets the maximum allowed dimensions for resizing images. Default value is 30000000 (30 megapixels), which allows resizing images up to approximately 6000 x 5000 px. This option is in place to protect server from attempting to resize image sizes beyond capabilities and/or to prevent slow performance.

menu_recursive_symlinks // true
List sub-directories of symlinks in the main menu. May cause harmless menu loops and/or duplicate menu items.

allow_symlinks // true
Allows Files app to display and follow symlinks in both the list and menu.

get_mime_type // false
Get file mime type from server (slow) instead of from extension (fast).

context_menu // null
Disable context-menu button and right-click menu.

prevent_right_click // null
Blocks browser right-click menu on sensitive items (images, list items, menu).

license_key // null
Insert license key here to prevent license popup and unlock features.
Removed options:
  • image_resize_min_filesize
  • image_resize_max_filesize
 
User avatar
mjau-mjau
X3 Wizard
Topic Author
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Files App Config

08 Nov 2021, 04:18

08 Nov 2021
Files App release 0.3.0

New options:
image_resize_dimensions_allowed // ''
Comma-separated list of allowed resize dimensions, in addition to two defaults. Not use directly in Files app, but useful if you want to configure additional image sizes for apps that use Files, like Embed. For example '640, 800, 1024'.

image_resize_types // 'jpeg, png, gif, webp, bmp'
Commma-separated list of image types to resize. Useful for example if you want to exclude PNG/GIF to retain transparency and animations.

folder_preview_image // true
Display preview images on folders.

folder_preview_default // '_filespreview.jpg'
Always prioritize this file as folder preview image, if it exists. Useful if you want to assign a specific image for some/all folders, or if you want to assign hidden preview images, or if you simply want to avoid the performance hit of searching each dir for first image to use as preview.

click_window // ''
Comma-separated list of file extension that you want to open directly in new window on click. Useful for easy viewing of PDF, HTML and text files, instead of opening a preview in Files app first.

click_window_popup // true
Opens new windows as 'popup' instead of new tab. Useful when opening and viewing PDF, HTML and text type documents. * Does not apply for mobile devices, which will mostly open in new window as normal.

filter_live // true
Live search filtering on keyboard input. If disabled, input filtering requires "return" or unfocus to trigger. Useful if you have 1000s of files in folders. * Does not apply for mobile devices, which allways triggers on "search" or keyboard-hide.

filter_props // 'name, filetype, mime, features, title'
File properties to use when filtering. More properties means slower processing. Available properties: name, filetype, mime, features, title, headline, description, creator, credit, copyright, keywords, city, sub-location, province-state.

download_dir // 'zip' / 'files' / '' false
Adds a button to download all files in dir as zip. Optionally, set to 'files' for batch multi-file download (useful, but only works on desktop). Disable by setting to '' (empty) or false.

download_dir_cache // 'dir' / 'storage' / '' /
Enable caching of created ZIP files in each dir (recommended). If disabled, ZIP files will need to get created on-the-fly for every download-click, which can be slow if there many files to zip. By default, zip file will get stored in each dir (most effective option). If you don't want to affect your folders, set to 'storage' to store the zip files inside _files/zip/*.

allow_upload // false
Allow upload files.

allow_delete // false
Allow delete files.

allow_rename // false
Allow rename files.

allow_new_folder // false
Allow create new folders.

allow_new_file // false
Allow create new files.

allow_duplicate // false
Allow duplicating files.

allow_text_edit // false
Allow editing text / code files.

demo_mode // false
When enabled, all filemanager operations will be blocked. Mainly used for the Files app demo.

upload_allowed_file_types // ''
Comma-separated list of file types allowed to upload. When set to empty (default), all file types are allowed. Items can be extension or mime-type with partial match, for example 'pdf, dog, image/*'.

upload_max_filesize // 0
Sets the maximum file size for uploads. 0 means 'unlimited', but file size will always be limited by your PHP upload_max_filesize.

upload_note // ''
Include a small text note at bottom of uploader. For example 'Max file size %upload_max_filesize%'.

upload_exists // 'increment'
Decides what to do if uploaded filename already exists in upload target folder. 'increment' (default) will rename the uploaded file so that it does not overwrite existing filename. For example 'filename.jpg' will become 'filename-2.jpg'. 'overwrite' will simply overwrite existing files with same file name, while 'fail' will cause the uploaded file to fail if same file name exists.

popup_video // true
Opens video formats in the popup (instead of modal).

popup_transition // 'glide'
Assign popup transition style: none, slide, glide, fade, zoom, pop, elastic.

popup_transition_play // 'inherit'
Assign popup transition style when in slideshow "play" mode. Default 'inherit' will use same transition as popup_transition option.

popup_caption // true
Display popup caption, created from various file properties.

popup_caption_hide // true
Autohide popup caption after a few seconds without user interaction.

popup_caption_style // 'block'
Assign popup caption style: block, box, gradient, topbar, none.

popup_caption_align // 'center-left'
Popup caption alignment left, center-left, center or right.

video_thumbs // true
Create thumbnails for video files. Requires FFmpeg and PHP exec().

video_ffmpeg_path // 'ffmpeg'
Path to FFmpeg for video thumbnail creation. Normally just 'ffmpeg', but some servers require a full path to the ffmpeg application

video_autoplay // true
Autoplay videos on click to open.

lang_default // 'en'
Default interface language if browser-language is not supported og `lang_auto` is disabled.

lang_auto // true
Automatically assign interface languages based on detected browser language.

lang_menu // false
Display a dropdown menu in topbar for language selection
Removed options:
  • image_cover
  • code_allow_edit (renamed to 'allow_text_edit')