prestaconcept / PrestaImageBundle

Allow to crop local and remote image before uploading them through a classic form.
MIT License
23 stars 19 forks source link

$el.data is not a function #63

Closed treeindark closed 4 years ago

treeindark commented 4 years ago

Hello,

I've this problem on click upload Button 'Image Locale'

on init $el is th .cropper element and ok,

on click: $el is an img -> $el.data is not a function

my install use jquery-cropper / the ressource cropper, what is the cropper.min ?

I've try with cropper.min from cropperjs and without.

Thanks for your help !

J-Ben87 commented 4 years ago

Hi,

Did you include the following (from https://github.com/fengyuanchen/jquery-cropper#installation)?

<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<script src="/path/to/cropper.js"></script><!-- Cropper.js is required -->
<link  href="/path/to/cropper.css" rel="stylesheet">
<script src="/path/to/jquery-cropper.js"></script>

And these (from https://getbootstrap.com/docs/4.4/getting-started/download/#bootstrapcdn)?

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

And the one from the bundle itself?

@PrestaImageBundle/Resources/public/css/cropper.css
@PrestaImageBundle/Resources/public/js/cropper.js
treeindark commented 4 years ago

It work !!!

i add the cropper from cropperjs,

and i add Cropper.noConflict(); before the init in my js


  - 'jquery-ui.min.js'         
  - "/bundles/prestaimage/js/cropper.js"       <- cropper from @PrestaImageBundle/Resources
  - "/bundles/prestaimage/js/cropper.min.js"    <- cropperjs from https://github.com/fengyuanchen/cropperjs
  - "/bundles/prestaimage/js/jquery-cropper.min.js"  <-from https://github.com/fengyuanchen/jquery-cropper
  - 'mine.js'     <- js init with Cropper.noConflict(); Before init Cropper
J-Ben87 commented 4 years ago

All good :slightly_smiling_face: