This is an old revision of the document!


Javascript plugins

fileuploader

https://innostudio.de/fileuploader/

  • Flow (adapted by KGI to use bootstrap modal)
    • Adding files by clicking <div class="fileuploader-input"> or dragging files into it
      1. jquery.fileuploader.js:
        • s = input element, p = parent element, o = new input element, l = list element, sl = input elements, n = options, f = fileuploader
        • f.init:
          • set p, language, merge options
          • n.beforeRender(parentEl p, inputEl s); Callback fired before rendering the fileuploader elements, by returning false, you will prevent the rendering
          • f.redesign();
            • set theme, set new input html, hide standard input
            • f.thumbnails.create(); create thumbnails list
              • n.thumbnails.beforeShow(parentEl p, newInputEl o, inputEl s); Callback fired before adding the list element
              • create box (n.thumbnails.box)
              • bind item popup, start, retry, rotate, remove/cancel methods to the selector n.thumbnails._selectors.popup_open, .start, .retry, .rotate, .remove
            • set drag&drop container
          • if (n.files) { f.files.append(n.files); } append files from options (see pre-loadin files)
          • n.afterRender(listEl l, parentEl p, newInputEl o, inputEl s); Callback fired after rendering the fileuploader elements
            • fotos.js.afterRender:
              • bind click to .fileuploader-input –> api.open()
              • bind dropdown buttons (.fileuploader-action-settings, .gallery-action-rename, .gallery-action-asmain)
      2. $('body').on('show.bs.modal', '#modalFotos', …) after clicking the button to show modal for a specific album
        • ajax/fileuploader.php {action: 'preload', fotoalbum_id: fotoalbumId}
        • api.reset();
        • api.append(preload)

—-

== Notes =

  1. ~~codedoc:xref:preloading~~ Pre-loading files
    • [{
          name: 'file.txt', // file name
          size: 1024, // file size in bytes
          type: 'text/plain', // file MIME type
          file: 'uploads/file.txt', // file path
          local: '../uploads/file.txt', // file path in listInput (optional)
          data: {
              thumbnail: 'uploads/file_thumbnail.jpg', // item custom thumbnail; if false will disable the thumbnail (optional)
              readerCrossOrigin: 'anonymous', // fix image cross-origin issue (optional)
              readerForce: true, // prevent the browser cache of the image (optional)
              readerSkip: true, // skip file from reading by rendering a thumbnail (optional)
              popup: false, // remove the popup for this file (optional)
              listProps: {}, // custom key: value attributes in the fileuploader's list (optional)
              your_own_attribute: 'your own value'
          }
      }]