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

Suggestion for new renaming method #7

Open
alexglue opened this issue Jul 31, 2015 · 2 comments
Open

Suggestion for new renaming method #7

alexglue opened this issue Jul 31, 2015 · 2 comments

Comments

@alexglue
Copy link

Could u please to add simple md5() renaming without part of original name?
And it will be nice to store files to subdirectories in this case, like /public/de/ad/be/ef/12/bb/ce/ed/deadbeef12bbceed.jpg for example.

@alexglue
Copy link
Author

alexglue commented Nov 5, 2015

  private function getFilename() {
    switch (config('media.config.rename')) {
      case 'transliterate':
        $this->filename_new = \Transliteration::clean_filename($this->filename_original);
        break;
      case 'unique':
        $this->filename_new = md5(microtime() . str_random(5)) .'.'. $this->filename_original;
        break;
      case 'nothing':
        $this->filename_new = $this->file->getClientOriginalName();
        break;
    }

    return $this->fileExistsRename();
  }

This is bad code. And I can do nothing to overload it, cause it's private.
I can do nothig to extend filename generation with my own function, md5() etc.

@markcameron
Copy link
Contributor

You could make a pull request..

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