Advertisement
freddy0512

dropzone

Oct 21st, 2015
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <!--form dropzone--->
  2. <form id="my-dropzone-1" action="<?php echo site_url('welcome/addfoto') ?>" class="dropzone">
  3. <input type="hidden" class="form-control" name="id_product_post" >
  4. </form>
  5.  
  6.  
  7. <!---js dropzone--->
  8. var minImageWidth1 = 300,
  9. minImageHeight1 = 200;
  10. Dropzone.options.myDropzone1 = {
  11. acceptedFiles: "image/*",
  12. addRemoveLinks: true,
  13. accept: function(file, done) {
  14. console.log("uploaded");
  15. done();
  16. },
  17.  
  18.  
  19. init: function() {
  20. this.on("processing", function(file) {
  21. this.options.url = base_url+"welcome/addfoto";
  22.  
  23. });
  24.  
  25. this.on("addedfile", function() {
  26. if (this.files[1]!=null){
  27. this.removeFile(this.files[0]);
  28. }
  29. });
  30.  
  31. this.on("thumbnail", function(file) {
  32. if (file.width < minImageWidth1 || file.height < minImageHeight1) {
  33. file.rejectDimensions()
  34. }
  35. else {
  36. file.acceptDimensions();
  37. }
  38. });
  39. },
  40. accept: function(file, done) {
  41. file.acceptDimensions = done;
  42. file.rejectDimensions = function() { done("Ukuran Sesuai kan"); };
  43. }
  44. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement