media.js 741 B

12345678910111213141516171819202122232425
  1. function get_curr_setup_file_path(setup, file_name) {
  2. let month_year_folder = ''
  3. let sub_dir = ''
  4. if (setup['SubDir']) {
  5. sub_dir = setup['BrandCode'] + '/'
  6. }
  7. const now = new Date()
  8. const month = now.getMonth() + 1
  9. if (setup['DateFolderType'] === '0') {
  10. month_year_folder = `/${now.getFullYear()}/` + ('00' + month.toString()).slice(-2)
  11. } else if (setup['DateFolderType'] === '1') {
  12. const day = now.getDate()
  13. month_year_folder = `/${now.getFullYear()}/` + ('00' + month.toString()).slice(-2) + '/' + ('00' + day.toString()).slice(-2)
  14. }
  15. return `/uploads${month_year_folder}/${sub_dir}` + file_name
  16. }
  17. function msset(src) {
  18. return window.env['MEDIA_URL'] + src
  19. }