PageSourceSearch

https://brisbaneprinthub.au/wp-content/plugins/customer-upload-fil…/front/assets/js/fme_cropper.js?ver=1.3.9

js brisbaneprinthub.au collected 2026-10-09 21:57:45 UTC 2,858 bytes, 97 lines download raw bytes

1jQuery(document).ready(function () {
2    var result = document.getElementById('result');
3    var image = document.getElementById('upoadedFile-crop');
4    var input = jQuery('input[name="fileToUpload[]"]');
5    var cropBtn = document.getElementById('btnCrop');
6
7
8    // particular image data
9    var rule_id = 0;
10    var fme_count = 0;
11    var file_type = "image/jpg";
12
13
14    var $modal = jQuery('#fme-file-cropper');
15    var cropper;
16
17    var cropper_enabled = fme_upload_files_button_display_settings.settings.fme_upload_files_enable_cropper;
18
19    if(1 == cropper_enabled) {
20      jQuery(document).on('change', 'input[name="fileToUpload[]"], .fme_upload_file', function (e) {
21          rule_id = jQuery(this).data('rule-id');
22          fme_count = jQuery(this).data('count-file');
23
24
25
26
27          // empty the result variable
28          result.src = "";
29          var files = e.target.files;
30          if ( files[0].type.match(/^image\//) ) {
31
32              // get uploaded image type
33              file_type = files[0].type;
34
35              var done = function (url) {
36                  image.src = url;
37                  $modal.addClass('fme-file-cropper-popup-wrapper-active').trigger('fme-modal-activated');
38              };
39
40              if (files && files.length > 0) {
41                  let file = files[0];
42                  reader = new FileReader();
43                  reader.onload = function (e) {
44                      done(reader.result);
45                  };
46                  reader.readAsDataURL(file);
47              }
48          }
49      });
50    
51    
52    
53      $modal.on('fme-modal-activated', function () {
54        cropper = initCropper(image);
55      }).on('fme-modal-deactivated', function () {
56        cropper.destroy();
57        cropper = null;
58      });
59
60      // crop image
61
62      jQuery('#btnCrop').on('click', function () {
63        // var initialAvatarURL;
64        var canvas;
65
66        
67        if (cropper) {
68          canvas = cropper.getCroppedCanvas();
69
70          // initialAvatarURL = avatar.src;
71          var imageData = canvas.toDataURL(file_type);
72          result.src = imageData;
73
74          // update preview image data
75          jQuery('#fme-preview-' + rule_id + '-' + fme_count).attr('src', imageData).closest('a').attr('href', imageData);
76          // update hidden input value
77          jQuery('#fme-cropped-image-' + rule_id + '-' + fme_count).val(imageData);
78          // update the link of the icons in case of icons
79          jQuery('.fme-visibility-icon-'+rule_id+'-'+fme_count).attr('href', imageData);
80        }
81
82
83        $modal.removeClass('fme-file-cropper-popup-wrapper-active').trigger('fme-modal-deactivated');
84      });
85    }
86    
87});
88
89
90  function initCropper(image){
91    cropper = new Cropper(image, {
92        aspectRation: 1,
93        viewMode: 3,
94        preview: '#preview'
95    });
96    return cropper;
97  }

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.