Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to configure filenames #13

Closed
bernhardh opened this issue Oct 23, 2018 · 2 comments
Closed

Option to configure filenames #13

bernhardh opened this issue Oct 23, 2018 · 2 comments

Comments

@bernhardh
Copy link
Contributor

bernhardh commented Oct 23, 2018

If you upload an image, the image keeps it original filename like "Fotolia-1224234.jpg". To prevent this, spatie allows to modify the filename with setFilename.

At the moment, there is no way to do this with this package. It would be great, to provide a way, to modify the filename, for example with a callback function. Something like this:

Images::make('Hauptbild', 'main')
    ->setFileName(function($originalFilename, $extension, $model){
        return md5($originalFilename) . "." . $extension;
    });
    
Images::make('Hauptbild', 'main')
    ->setFileName(function($originalFilename, $extension, $model){
        return str_slug($model->name) . "." . $extension;
    });
@bernhardh
Copy link
Contributor Author

See pull request

ebess pushed a commit that referenced this issue Oct 25, 2018
@ebess
Copy link
Owner

ebess commented Oct 25, 2018

merged #14

@ebess ebess closed this as completed Oct 25, 2018
Gompje pushed a commit to DaktaDeo/advanced-nova-media-library that referenced this issue Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants