Giter Club home page Giter Club logo

cropme's People

Contributors

pellul avatar shpontex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cropme's Issues

Was the .on removed?

I'm looking through examples and they have a cropme.on("crop:stop"...) event. Was that removed? I'd like to be able to get at the position whenever it changes - is that possible now?

Cropme Ghosting issue

While dragging the image in the crop area, there seems to be a trail. This wasn't an issue last week, I'm not sure what's changed. It also applies to the demo.

  • Windows 10, Chrome lastest build, JQuery & Bootstrap.

Not working at all.

I tried to use this plugin but its not working.

I get below error in browser console:
cropme.min.js:10 Uncaught Error: the argument must be an object or a string

IE Edge does not return when crop is called

Works in Chrome and Firefox and even IE Edge dev version on mac. I double checked the demo as well in edge and same result I get in my site no output returned from crop method and results in empty.

Edit: added more details

Changing image dpi

The crop() output seems to default the base64 image to 96dpi. I can't seem to find anything in the js file to adjust the resolution. We need to output image at 300dpi to meet the requirements.
Could you point me in the right direction on how to address this issue?

Touch zoom is expecting to find a slider

When setting zoom to enabled (default) but slider disabled (default) the zoom is breaking on mobile pinch/zoom.

It can easily be recreated by adjusting the settings on the demo to the above and testing on a mobile device.

https://shpontex.github.io/cropme/

[Error] TypeError: undefined is not an object (evaluating 'self.properties.slider.value = touches_dist / self.properties.od')

line 405 cropme.js:

self.properties.scale = self.properties.slider.value = touches_dist / self.properties.od;

MouseWheel not working on Firefox

Hi,

I don't know if you can fix this, but the MouseWheel feature not working on Firefox. it's ok on Chrome, IE and Safari.

Thanks for your good work

getting issue on resizing screen after destroying the "cropme instance".

Firstly I uploaded an Image and when it finally uploaded on server, I destroyed the current cropme instance, so when next time I upload new image there would be new instance created.
But when I destroy the current cropme instance and after that tried to resize the current screen (I tried dragging the element inspector) but getting error in that case and the error is like:

cropme.js:1023 Uncaught TypeError: Cannot read properties of undefined (reading 'container')
at Cropme.resize

License?

What is the license of this project?
thank you. great work

Zoom in-out not working in mobile

My cropme works perfectly in desktop, but in mobile I try to zoom it just fires the rotation event. Maybe I miss some steps or plugins. Please help, thank you.

Image ID delete from DOM after init

Good morning all,

I just found a little bug it seems to me. I'm on the latest version of Google Chrome, but it does the same with Safari. When initializing the cropme the image id is deleted from the DOM. You have to go through another jQuery selector for this to work.

myImage = $ ('. cropme-container> img'). cropme ();

cropme is blocked when using Content Security Policy Header

When using Content Security Policy Header, the browser generates a page error into the console, because the script is using either eval(), new Function(), setTimeout([string], ...) or setInterval([string], ...) for evaluating strings.

image

As CSP is a common thing to use and unsafe-eval usually should not be enabled, I´d consider this a bug.

cropme - 'viewport' of undefined

when I crop an image for first time it work great. (after cropping i would destroy the cropme. )
but when I want to crop second image i would get this error

app.js?id=79f598946b8ba4ad1fb4:12442 Uncaught TypeError: Cannot read property 'viewport' of undefined
    at Cropme.createCanvas (app.js?id=79f598946b8ba4ad1fb4:12442)
    at Cropme.crop (app.js?id=79f598946b8ba4ad1fb4:12664)
    at jQuery.fn.init.jQuery.fn.cropme (app.js?id=79f598946b8ba4ad1fb4:12088)
    at HTMLButtonElement.<anonymous> (app.js?id=79f598946b8ba4ad1fb4:10234)
    at HTMLDocument.dispatch (app.js?id=79f598946b8ba4ad1fb4:20741)
    at HTMLDocument.elemData.handle (app.js?id=79f598946b8ba4ad1fb4:20545)

this is my script:

cropImage = (item) => {
    var myImage = $(item).cropme({

        "viewport": {
            "width": 200,
            "height": 200,
            "type": "circle",
            "border": {
                "width": 2,
                "enable": true,
                "color": "#fff"
            }
        },
        "zoom": {
            "enable": true,
            "mouseWheel": true,
            "slider": true
        },
        "rotation": {
            "slider": true,
            "enable": true,
            "position": "left"
        },
        "transformOrigin": "image"
    });
    var rotate = 0;
    $(document).on('click', '.rotate', function () {
        rotate = rotate + 90;
        console.log(rotate);
        myImage.cropme('rotate', rotate);
    });
    $(document).on('click', '.crop', function () {
        let resultImage = $(this).data('target');
        console.log('myImage', myImage);

        myImage.cropme('crop', {
            type: 'base64',
            width: 200
        }).then(function (output) {
            $(resultImage).attr('src', output);
            $('.base65-holder').val(output);
            setTimeout(function () {
                myImage.cropme('destroy');
            }, 200);
            $('.js--delete-user-photo').removeClass('invisible');
            $('.crop').addClass('invisible');
        });
    })
}

// I call the function after uploading the image:
reader.onload = function (e) {
  $(result).append('<img id="uploaded-photo" src='+e.target.result+' height="100">');
  if(resizable){
	  cropImage('#uploaded-photo');
  }
};

How to use position data in backend

Hi,

Is there a way to use the position data to generate the crop image inside an backend? I've tried it with PHP & Imagick but could not get the same result. Maybe its the order in which I need to apply the details (scale, rotate, crop)?

Can you provide some info on that?

Rotation during cropping from iphone camera. OK on android device

Good morning all,

I just found a little bug it seems to me. When I make a crop of an image taken directly from the camera of my iPhone it is well oriented when selecting the area to keep (before the crop). But once the crop made, the base64 image is sent rotated by 90 °.

This works on iPhone if you use a downloaded photo for example, but it poses a problem if the photo was taken with the camera of the iPhone, either directly from the camera, or from the photo library with a photo that was taken with the camera.

It works correctly on Android devices with file sent or from the camera directly.

Do you have an idea or a lead to correct this problem please?

Calling crop() in javascript

Hi there, first off all, your plugin is everything I am looking for, great work!
Sadly I cannot get the crop() function to work in pure javascript.

So far I have:
var element = document.querySelector('.crop-image');
var crp = new Cropme(element, {
...
});

var crop_btn = document.querySelector('.js-crop');
crop_btn.addEventListener('click',
crp.cropme('crop', {
type: 'base64',
width: 800
}).then(function(output) {
// here you can use the base64 output
});;
});

As soon as I hit the button, I get an error "e.cropme() is not a function". Could you please point me into the right direction?

Thanks in advance!

Why hijack the native Promise object?

I notice that this library hijacks the native Promise object and adds a wrapper over it. Can this be avoided, or is there a way or a config option to opt out of it?

How to set position on init ?

HTML:
<img src="/img/photo.jpg" id="avatar" />

JS:
var avatar = $('#avatar').cropme();

How i can to set scale, x, y on page load ?

crop not work ios 13.5 (cordova wkwebview)

when crop , there is no response , no error message on ios 13.5 (cordova wkwebview)
works on desktop chrome & mobile safari

Cropme123.crop({
width: 300
}).then(function(output) {
// here you can use the blob output
$("#img_cropped").attr("src",output) ;
$("#img_cropped").show() ;
//$("#img_001").hide() ;
$("#container").hide() ;

	   $("#img_cancel").show() ;
	   $("#btn_crop_pic").hide() ;
	    $("#img_zoom").hide() ;
  });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.