Feature Request: Add a URL suffix setting
Is your feature request related to a problem? Please describe.
Add a URL suffix option in settings. So that the URLs of uploaded files can be appended some more contents like query strings.
In my case, I use Alibaba Cloud OSS, an S3-compatible service. It provides an image processing function, in which I can define image processing rules (to add watermark, compress, etc.) and append a query string like ?x-oss-process=style/<rule name>
after the image URL to get a post-processed image. I can also serve processed images only and disable access to the original image.
For example, if I uploaded an image to OSS and get the URL https://static.my.site/image.jpg
, I can use the URL https://static.my.site/image.jpg?x-oss-process=style/forum
to apply a image processing rule named forum
to the image. It also provides a shorter way to add that post-processing rule like this: https://static.my.site/image.jpg/forum
.
Describe the solution you'd like
Add an option in the extension settings so I can set a suffix to the URLs in the database.
Describe alternatives you've considered
Since I am not familiar with setting up a development environment and fear of breaking things, I just changed the code manually in my installation.
In file vendor/fof/upload/src/Adapters/AwsS3.php
:
...
protected function generateUrl(File $file)
{
...
- $file->url = sprintf('%s/%s', $cdnUrl, Arr::get($this->meta, 'path', $file->path));
+ $file->url = sprintf('%s/%s?x-oss-process=style/forum', $cdnUrl, Arr::get($this->meta, 'path', $file->path));
}
...