daun / statamic-original-filename
Remember the original filenames of assets uploaded in Statamic
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:statamic-addon
pkg:composer/daun/statamic-original-filename
Requires
- php: ^8.2
- statamic/cms: ^5.70
Requires (Dev)
- larastan/larastan: ^2.9 || ^3.0
- laravel/pint: ^1.14
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.0 || ^9.0 || ^10.0
- pestphp/pest: ^2.0 || ^3.3
- pestphp/pest-plugin-laravel: ^3.0
- spatie/ray: ^1.42
README
Remember the original, unsanitized filenames of assets uploaded in Statamic.
This addon stores the original filename of uploaded assets in their metadata, allowing later access even after Statamic has sanitized the filename for compatibility. Useful for allowing downloads with the original name or displaying the original name to editors.
- Filename as uploaded:
Long-Tailed Duck © Ray Hennessy.jpg - Filename as sanitized:
long-tailed-duck-ray-hennessy.jpg - Original filename:
Long-Tailed Duck © Ray Hennessy
Installation
composer require daun/statamic-original-filename
Usage
Once installed, the addon will store the original filename of each uploaded asset in its
metadata under the key original_filename. The filename is saved without the file extension.
Frontend
{{ asset }}
<a href="{{ url }}" download="{{ original_filename }}.{{ extension }}">
Download {{ original_filename }}
</a>
{{ /asset }}
Backend
If you want your editors to see (and possibly edit) the original filename in the control panel,
add a text field to your asset blueprint, using original_filename as the handle.
title: Asset
fields:
-
handle: alt
field:
type: text
display: Alt Text
+ -
+ handle: original_filename
+ field:
+ type: text
+ display: Original Filename