Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4cc8425
Accessibility Aria & Alt
alsmpd Sep 22, 2017
7c693b7
Accessibility Label
alsmpd Sep 22, 2017
a4f012d
Accessibility dropeffect
alsmpd Sep 22, 2017
7fb6462
Accessibility Label (Again)
alsmpd Sep 26, 2017
f684a9b
Merge pull request #388 from Foliotek/Accessibility-1
alsmpd Oct 12, 2017
55ba456
Set correct value for accessibility attribute when rotate picture
korenskoy Oct 14, 2017
99ab016
Merge pull request #401 from korenskoy/master
alsmpd Oct 16, 2017
eeac700
2.5.0 Prep
alsmpd Oct 19, 2017
fcbc826
2.5.1
alsmpd Oct 19, 2017
2f48690
Seems to be a fix for the aspect ratio problem with square images. (#…
nathanwienand Oct 19, 2017
f2158da
Updated index.html (#358)
jofftiquez Oct 19, 2017
19200f9
Fix Issue 397 (#398)
michib Oct 19, 2017
c70135b
fix error from #378
thedustinsmith Oct 19, 2017
83758d1
Fix zoom problems with enforceBoundary turned off (#405)
pknoe3lh Oct 19, 2017
515c787
trying to cleanup
thedustinsmith Oct 19, 2017
6754be1
Update README.md
thedustinsmith Nov 17, 2017
c8d203c
fixes for several issues; including #396
thedustinsmith Dec 8, 2017
e158771
#383 - don't allow more than one initialized instance on element
thedustinsmith Dec 8, 2017
8430d4a
#384 - document enableResize
thedustinsmith Dec 8, 2017
97b9b7e
added ctrl key required to zoom option
Jan 4, 2018
66d873e
some exif/rotation changes
thedustinsmith Jan 8, 2018
a6a525d
Create ISSUE_TEMPLATE.md
thedustinsmith Jan 9, 2018
540aaad
remove note about ie9
thedustinsmith Jan 9, 2018
801795e
#241 don't allow rotation without orientation included
thedustinsmith Jan 9, 2018
4bf2cda
Updated README (#432)
jofftiquez Jan 9, 2018
fce102b
added a maxZoom option to enable larger zoom (#391)
DocKuro Jan 9, 2018
37c6ac1
Update croppie.js (#425)
arthurcannon Jan 9, 2018
7b09372
comment and commit min file;
thedustinsmith Jan 9, 2018
2b061eb
Some documentation updates for clarification
thedustinsmith Jan 9, 2018
22d7d6d
fix typo in documentation
thedustinsmith Jan 9, 2018
08d8e21
Merge branch 'master' into pre-2.5.2
thedustinsmith Jan 19, 2018
cd08407
Remove unnecessary export (#452)
sarunint Jan 29, 2018
1c848c3
Merge remote-tracking branch 'origin/master' into pre-2.5.2
thedustinsmith Feb 5, 2018
add10fb
Add namespace to update event (#458)
jkeedy Feb 5, 2018
25593fc
merge conflicts with master
thedustinsmith Feb 5, 2018
25595ec
Merge branch 'elmadraka-mouseWheelZoomCtrl'
thedustinsmith Feb 5, 2018
69f23af
Merge branch 'master' of https://github.com/Foliotek/Croppie
thedustinsmith Feb 5, 2018
3effe09
cleanup documentation/demo html
thedustinsmith Feb 5, 2018
e914ec5
clarifying documentation on new option
thedustinsmith Feb 5, 2018
7e96d5c
update readme
thedustinsmith Feb 5, 2018
a89bda0
prep for 2.6.0
thedustinsmith Feb 5, 2018
315de4a
2.6.0
thedustinsmith Feb 5, 2018
71f637d
I like this setup for a demo better
thedustinsmith Feb 5, 2018
12ab62e
remember to copy the class list over when replacing the image
thedustinsmith Feb 5, 2018
e5eea26
prep for 2.6.1
thedustinsmith Feb 5, 2018
1c67a9b
2.6.1
thedustinsmith Feb 5, 2018
32b4f59
Fix typo that makes it unusable in strict mode (#481)
nolimits4web Feb 21, 2018
3a61566
Fix enforce boundary (#484)
jlane9 Mar 16, 2018
6cee78e
prep for 2.6.2
thedustinsmith Mar 16, 2018
c2ac633
2.6.2
thedustinsmith Mar 16, 2018
6a6bc79
Fix reading EXIF orientation when 'enableOrientation' is true (#499)
uwolfer Mar 26, 2018
9aefc6e
Fix UMD, export the whole Croppie class (#479)
sarunint May 22, 2018
39e648e
Fix linting issues (#500)
uwolfer May 22, 2018
4bb6c7a
Fix rotate (#504)
swznd May 22, 2018
8f90ab4
Don't silently discard image loading errors (#511)
fdanielsen May 22, 2018
8dc634a
Fix global, AMD and CommonJS definition (#532)
sarunint May 23, 2018
959a0a1
Updated croppie-dart link (#538)
cassmtnr Jul 27, 2018
f5746a6
Update README.md (#577)
jofftiquez Jan 19, 2019
d69eef5
Update README.md (#578)
jofftiquez Jan 19, 2019
9857faa
Fix docs typo (#582)
ambroseya Jan 19, 2019
018df48
Add the option to set a minimum zoom ratio. (#583)
snstrauss Jan 19, 2019
175903b
Resolve cropping issues when enforceBoundary is set to false (#592)
zdennis Jan 19, 2019
70cdc4b
2.6.3 prep
thedustinsmith Jan 21, 2019
165ecd1
2.6.3
thedustinsmith Jan 21, 2019
680db73
Fix: Fix issue with unassigned variable (#617)
Jan 24, 2019
b442a7d
2.6.4 prep
Mar 15, 2019
9932dad
2.6.4
Mar 15, 2019
ea9b703
2.6.4
Apr 10, 2019
b097335
Fixes #515 Supersedes #519 (#647)
jedsmith13 Apr 17, 2019
5142170
cleaner fix for #552 (#654)
nicod-pc May 24, 2019
8986e13
Warning error (#623)
michael-letcher May 24, 2019
84a7e81
Checking for existence of environment specific features before using …
ofzza Jun 4, 2019
9d01391
2.6.5 prep
thedustinsmith Jun 16, 2020
8998b1e
2.6.5
thedustinsmith Jun 16, 2020
6d55b7b
Use better algo for zoom slider
s0ber Sep 20, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Expected Behavior


## Actual Behavior


## Steps to Reproduce the Problem

1.
1.
1.

## Example Link
Please recreate your issue using [JSbin](https://www.jsbin.com), [JSFiddle](https://jsfiddle.net), or [Codepen](https://codepen.io).
* Link:


## Specifications

- Browser:
- Version:
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Download:
[croppie.js](croppie.js) & [croppie.css](croppie.css)

## Adding croppie to your site
```
```html
<link rel="stylesheet" href="croppie.css" />
<script src="croppie.js"></script>
```
Expand All @@ -27,19 +27,25 @@ https://cdnjs.cloudflare.com/ajax/libs/croppie/{version}/croppie.min.js
[Documentation](http://foliotek.github.io/Croppie#documentation)

## Related Libraries
* https://github.com/wem/croppie-dart
* https://github.com/allenRoyston/ngCroppie
* https://github.com/lpsBetty/angular-croppie

* [croppie-dart](https://gitlab.com/michel.werren/croppie-dart)
* [ngCroppie](https://github.com/allenRoyston/ngCroppie)
* [angular-croppie](https://github.com/lpsBetty/angular-croppie)
* [django-croppie](https://github.com/dima-kov/django-croppie)
* [vue-croppie](https://github.com/jofftiquez/vue-croppie)

## Contributing
#### Static Server
`live-server`
First, thanks for contributing. This project is difficult to maintain with one person. Here's a "checklist" of things to remember when contributing to croppie.
* Don't forget to update the documentation.
* If you're adding a new option/event/method, try adding to an example on the documentation. Or create a new example, if you feel the need.
* We don't have tests for Croppie :( (if you want to create tests I'd be forever grateful), so please try to test the functionality you're changing on the demo page. I've tried to add as many use-cases as I can think of on there. Compare the functionality in your branch to the one on the official page. If they all still work, then great!

If you're looking for a simple server to load the demo page, I use https://github.com/tapio/live-server.

#### Minifying
`uglifyjs croppie.js -c -m -r '$,require,exports' -o croppie.min.js`

#### Releasing a new version
For the most part, you shouldn't worry about these steps unless you're the one handling the release. Please don't bump the release and don't minify/uglify in a PR. That just creates merge conflicts when merging. Those steps will be performed when the release is created.
1. Bump version in croppie.js
2. Minify/Uglify
3. Commit
Expand Down
384 changes: 237 additions & 147 deletions croppie.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion croppie.min.js

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions demo/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ h1 {
padding-top: 30px;
margin: 15px 0;
}

h3 {
font-size: 18px;
font-weight: 400;
border-bottom: 1px solid #0C4648;
margin: 15px 0 10px;
}
nav {
position: absolute;
top: 0;
right: 0;
padding:15px;
}

nav a {
Expand Down Expand Up @@ -171,12 +177,6 @@ h2 {
margin: 0 0 5px 0;
}

.documentation h3 {
font-size: 18px;
font-weight: 400;
border-bottom: 1px solid #0C4648;
margin: 15px 0 10px;
}
.documentation ul {
list-style: none;
padding: 0;
Expand Down Expand Up @@ -218,6 +218,10 @@ h2 {
color: #777;
}

.important-notes article {
margin-bottom: 2em;
}

.upload-demo .upload-demo-wrap,
.upload-demo .upload-result,
.upload-demo.ready .upload-msg {
Expand Down
28 changes: 17 additions & 11 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,24 @@ var Demo = (function() {
viewport: {
width: 150,
height: 150,
type: 'square'
type: 'circle'
},
boundary: {
width: 300,
height: 300
},
// url: 'demo/demo-1.jpg',
enforceBoundary: false
// enforceBoundary: false
// mouseWheelZoom: false
});
mc.on('update', function (ev, data) {
mc.on('update.croppie', function (ev, data) {
// console.log('jquery update', ev, data);
});
$('.js-main-image').on('click', function (ev) {
mc.croppie('result', {
type: 'rawcanvas',
// size: { width: 300, height: 300 },
type: 'rawcanvas',
circle: true,
// size: { width: 300, height: 300 },
format: 'png'
}).then(function (canvas) {
popupResult({
Expand Down Expand Up @@ -93,7 +94,11 @@ var Demo = (function() {
}
basic.croppie('result', {
type: 'canvas',
size: size
size: size,
resultSize: {
width: 50,
height: 50
}
}).then(function (resp) {
popupResult({
src: resp
Expand All @@ -105,7 +110,7 @@ var Demo = (function() {
function demoVanilla() {
var vEl = document.getElementById('vanilla-demo'),
vanilla = new Croppie(vEl, {
viewport: { width: 100, height: 100 },
viewport: { width: 200, height: 100 },
boundary: { width: 300, height: 300 },
showZoomer: false,
enableOrientation: true
Expand All @@ -116,7 +121,7 @@ var Demo = (function() {
zoom: 0
});
vEl.addEventListener('update', function (ev) {
console.log('vanilla update', ev);
// console.log('vanilla update', ev);
});
document.querySelector('.vanilla-result').addEventListener('click', function (ev) {
vanilla.result({
Expand All @@ -140,7 +145,8 @@ var Demo = (function() {
boundary: { width: 300, height: 300 },
showZoomer: false,
enableResize: true,
enableOrientation: true
enableOrientation: true,
mouseWheelZoom: 'ctrl'
});
resize.bind({
url: 'demo/demo-2.jpg',
Expand Down Expand Up @@ -228,13 +234,13 @@ var Demo = (function() {
}

function bindNavigation () {
var $body = $('body');
var $html = $('html');
$('nav a').on('click', function (ev) {
var lnk = $(ev.currentTarget),
href = lnk.attr('href'),
targetTop = $('a[name=' + href.substring(1) + ']').offset().top;

$body.animate({ scrollTop: targetTop });
$html.animate({ scrollTop: targetTop });
ev.preventDefault();
});
}
Expand Down
60 changes: 46 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
<a id="home" name="home"></a>
<div class="container">
<nav>
<ul>
<a href="#options">Usage</a>
<a href="#documentation">Documentation</a>
<a href="#demos">Demos</a>
<a href="#browsers">About</a>
</ul>
<a href="#options">Usage</a>
<a href="#documentation">Documentation</a>
<a href="#demos">Demos</a>
<a href="#browsers">About</a>
</nav>
<div class="grid">
<div class="col-1-2">
Expand Down Expand Up @@ -129,6 +127,12 @@ <h3>Options</h3>
<span class="default">Default</span>
<code class="language-javascript">false</code>
</li>
<li id="enableResize">
<strong class="focus">enableResize</strong><em>boolean</em>
<p>Enable or disable support for resizing the viewport area.</p>
<span class="default">Default</span>
<code class="language-javascript">false</code>
</li>
<li id="enableZoom">
<strong class="focus">enableZoom</strong><em>boolean</em>
<p>Enable zooming functionality. If set to false - scrolling and pinching would not zoom.</p>
Expand All @@ -140,8 +144,8 @@ <h3>Options</h3>
<span class="default">Default</span><code class="language-javascript">true</code>
</li>
<li id="mouseWheelZoom">
<strong class="focus">mouseWheelZoom</strong><em>boolean</em>
<p>Enable or disable the ability to use the mouse wheel to zoom in and out on a croppie instance</p>
<strong class="focus">mouseWheelZoom</strong><em>bool/string</em>
<p>Enable or disable the ability to use the mouse wheel to zoom in and out on a croppie instance. If <code class="language-javascript">'ctrl'</code> is passed mouse wheel will only work while control keyboard is pressed</p>
<span class="default">Default</span><code class="language-javascript">true</code>
</li>
<li id="showZoomer">
Expand Down Expand Up @@ -172,13 +176,13 @@ <h3>Methods</h3>
</li>
<li id="bind">
<strong class="focus">bind({ url, points, orientation, zoom })</strong><em>Promise</em>
<p>Bind an image the croppie. Returns a promise to be resolved when the image has been loaded and the croppie has been initialized.</p>
<p>Bind an image to the croppie. Returns a promise to be resolved when the image has been loaded and the croppie has been initialized.</p>
<span class="default">Parameters</span>
<br />
<ul class="parameter-list">
<li><code class="language-javascript">url</code> URL to image</li>
<li><code class="language-javascript">points</code> Array of points that translate into <code class="language-javascript">[topLeftX, topLeftY, bottomRightX, bottomRightY]</code></li>
<code class="language-javascript">zoom</code> Apply zoom after image has been bound
<li><code class="language-javascript">zoom</code> Apply zoom after image has been bound </li>
<li><code class="language-javascript">orientation</code> Custom orientation, applied after exif orientation (if enabled). Only works with
<code class="language-javascript">enableOrientation</code> option enabled (see 'Options').
<br />
Expand All @@ -192,7 +196,6 @@ <h3>Methods</h3>
<li><code class="language-javascript">6</code> rotated clockwise by 90 degrees</li>
<li><code class="language-javascript">7</code> flipped horizontally, then rotated right by 90 degrees</li>
<li><code class="language-javascript">8</code> rotated counter-clockwise by 90 degrees</li>
</pre>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -275,13 +278,19 @@ <h3>Methods</h3>
</li>
</ul>
</li>
</ul>
</section>
<section>
<h3>Events</h3>
<ul>
<li id="update">
<strong class="focus">update(croppe)</strong><em>Croppie</em>
<strong class="focus">update(croppie)</strong><em>Croppie</em>
<p>Triggered when a drag or zoom occurs</p>
<pre class="language-javascript"><code class="language-javascript">
$('.my-croppie').on('update.croppie', function(ev, cropData) {});
// or
document.getElementById('another-croppie').addEventListener('update', function(ev) { var cropData = ev.detail; });
</code></pre>
</li>
</ul>
</section>
Expand Down Expand Up @@ -370,7 +379,8 @@ <h2>Demos</h2>
boundary: { width: 300, height: 300 },
showZoomer: false,
enableResize: true,
enableOrientation: true
enableOrientation: true,
mouseWheelZoom: 'ctrl'
});
resize.bind({
url: 'demo/demo-2.jpg',
Expand Down Expand Up @@ -447,6 +457,29 @@ <h2>Demos</h2>
</div>
</section>

<section class="important-notes">
<a id="important-notes" name="important-notes"></a>
<div class="section-header"><h2>Important Notes</h2></div>
<div class="container">
<article>
<a id="cors" name="cors"></a>
<h3>Image Hosting & Cross Origin Errors</h3>
<p>Croppie uses <code class="language-javascript">canvas.drawImage(...)</code> to manipulate images. Thus, images must obey the CORS policy. More info can be found <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image">here</a>.</p>
</article>
<article>
<a id="visibility" name="visibility"></a>
<h3>Visibility and Binding</h3>
<p>Croppie is dependent on it's container being visible when the <a href="#bind">bind</a> method is called. This can be an issue when your croppie component is inside a modal that isn't shown. Let's take the bootstrap modal for example..</p>
<pre class="language-javascript"><code class="language-javascript">
var myCroppie = $('#my-croppie').croppie(opts);
$('#my-modal').on('shown.bs.modal', function(){
myCroppie.croppie('bind', bindOpts);
});
</code></pre>
<p>If you are having issues getting the correct crop result, and your croppie instance is shown inside of a modal, try taking your croppie out of the modal and see if your issues persist. If they don't, then make sure that your bind method is called after the modal is done animating.</p>
</article>
</div>
</section>

<section class="browsers">
<a id="browsers" name="browsers"></a>
Expand All @@ -465,7 +498,6 @@ <h2>Browser Support</h2>
<li>iOS</li>
<li>Android</li>
</ul>
<p><strong>IE9</strong> may be supported, but it isn't tested. If you're able to test it and let us know, please do so on Github.</p>
</div>
</section>
<section class="who">
Expand Down
Loading