-1

I'm uploading an image using the rainlab builder plugin. Say for example the file is called "my_image.jpg"

This will get uploaded to storage/uploads/public/56f/809/658/56f809658.jpg This isn't very seo friendly so I want it to keep it's original filename my_image.jpg

Any help would be appreciated. thanks

Mr Pickles
  • 39
  • 3

1 Answers1

0

may be for public files you need to use mediafinder widget

as we need to store this files anyways in public space so we can use mediafinder

as described here by author https://github.com/octobercms/october/issues/964

you can define extra fieldname in table like for ex: banner(text)

and then you can use that field and mediafinder combination to achieve SEO friendly names.

column config :

fields:
    ... some fields 

    banner:
        label: Banner
        oc.commentPosition: ''
        mode: file
        span: auto
        type: mediafinder

when you want show image you can use :

page code section

use HardikSatasiya\DemoTest\Models\Demo;
function onStart() {
    $this['record'] = Demo::find(5);
}

page markup section

<img src="{{ record.banner|media }}" alt='extra-seo-name' />

rendered out put

<img src="/storage/app/media/drawing.png" alt='extra-seo-name' />
Hardik Satasiya
  • 9,547
  • 3
  • 22
  • 40