Git Product home page Git Product logo

Comments (15)

thedustinsmith avatar thedustinsmith commented on May 23, 2024

Currently it's not possible through the API. You could manually set the value of the slider and trigger a change, and that should work.

However, I've always thought this would be a good feature to have. I'm just not sure on the implementation of it. It's tough adding a zoom option to bind() since we don't know the min and max zoom until we determine the size of the image.

Any suggestions for an implementation?

from croppie.

chandraa06 avatar chandraa06 commented on May 23, 2024

Already I'm setting currenzoom value to 0.6 like that. But it doesn't
changing

On Sat, Jan 9, 2016, 12:13 AM Dustin Smith [email protected] wrote:

Currently it's not possible through the API. You could manually set the
value of the slider and trigger a change, and that should work.

However, I've always thought this would be a good feature to have. I'm
just not sure on the implementation of it. It's tough adding a zoom
option to bind() since we don't know the min and max zoom until we
determine the size of the image.

Any suggestions for an implementation?


Reply to this email directly or view it on GitHub
https://github.com/Foliotek/Croppie/issues/40#issuecomment-170086954.

from croppie.

thedustinsmith avatar thedustinsmith commented on May 23, 2024

I'd have to see some code to offer useful advice. Are you triggering a change on the slider?

from croppie.

chandraa06 avatar chandraa06 commented on May 23, 2024

function _initializeZoom() {
var self = this,
wrap = self.elements.zoomerWrap = document.createElement('div'),
zoomer = self.elements.zoomer = document.createElement('input'),
origin,
viewportRect,
transform;

    wrap.classList.add('cr-slider-wrap');
    zoomer.type = 'range';
    zoomer.classList.add('cr-slider');
    zoomer.step = '0.01';
    zoomer.value = 1;

    self.element.appendChild(wrap);
    wrap.appendChild(zoomer);

self._currentZoom = 0.6;
change();

    ////chandra additional code wrote here this line

    //_setZoomerVal.call(self, 0);
    ////chandra additional code wrote here ends this line

from croppie.

thedustinsmith avatar thedustinsmith commented on May 23, 2024

I suspect it's because you're passing 0 as a parameter into that function. What are you trying to accomplish by setting the zoom to zero?

from croppie.

chandraa06 avatar chandraa06 commented on May 23, 2024

Ya, that's what I'm trying in that function, could you help me with that?

On Tue, Jan 12, 2016, 7:37 PM Dustin Smith [email protected] wrote:

I suspect it's because you're passing 0 as a parameter into that function.
What are you trying to accomplish by setting the zoom to zero?


Reply to this email directly or view it on GitHub
https://github.com/Foliotek/Croppie/issues/40#issuecomment-170921764.

from croppie.

thedustinsmith avatar thedustinsmith commented on May 23, 2024

Why are you passing 0 into that function?

from croppie.

chandraa06 avatar chandraa06 commented on May 23, 2024

Bcz you set zoom step as a0.01 and zoom value= 1, so I thought your using 0
to 1 as zoom range

On Tue, Jan 12, 2016, 11:25 PM Dustin Smith [email protected]
wrote:

Why are you passing 0 into that function?


Reply to this email directly or view it on GitHub
https://github.com/Foliotek/Croppie/issues/40#issuecomment-170993354.

from croppie.

thedustinsmith avatar thedustinsmith commented on May 23, 2024

We set zoom range based on the width of the image you bind and the width of your viewport. Regardless of that, setting zoom to 0 is never going to work. Since the scale of the image could never be 0, unless you didn't want the image to be visible.

Check out line 657, that's where we're setting the min and the max zooms.

from croppie.

thedustinsmith avatar thedustinsmith commented on May 23, 2024

I added a setZoom(value) method. This should allow you to do what you want to do. Thanks for the submission.

from croppie.

maxvaser avatar maxvaser commented on May 23, 2024

@thedustinsmith - Very cool and useful library!!

It looks like the setZoom function is throwing an error when called. Using version 2.0.1.
just tried to add the uploadCrop.setZoom(0); or uploadCrop.setZoom(1);
after the bind default image call. I would like a default image to be the viewport size. uploadCrop is my Croppie instance.
firebug: Error: TypeError: uploadCrop.setZoom is not a function

P.S. The croppie.min.js doesn't seem to be the current version either.

Thanks!

from croppie.

thedustinsmith avatar thedustinsmith commented on May 23, 2024

@maxvaser - Thanks!

How'd you install croppie? By just downloading the files from github? I'm not very good about keeping master in check by minifying and testing.

Is your uploadCrop a jquery cropper? If so you need to call uploadCrop.croppie('setZoom', val)

from croppie.

maxvaser avatar maxvaser commented on May 23, 2024

@thedustinsmith thanks! I am using the Jquery methods. That's it, no errors. I was apparently using the example that's for the vanilla.
If I set the value to zero it still sets the default image to the boundary box and not the smaller viewport size. I was thinking zero would set it to viewport since if you were showing the existing image for a profile pic then it's zoomed in a bit and pixelated. If that's not the intention of setZoom. Then maybe a setting to set the initial slider value to zero would do the trick. I didn't see a method for that. Does it exist?

I pulled it in using NPM, which I think just pulls directly from github version you have set in the package.json file.

Thanks again!

from croppie.

thedustinsmith avatar thedustinsmith commented on May 23, 2024

There's a bit of confusion with setZoom. Seems like most people, like you, believe the value passed in should be in relative to the size of the image relative to the boundary. Whereas I'm just setting the zoom to value * the native size of the image. Obviously, I need to give this one some thought.

from croppie.

GaganTiwari avatar GaganTiwari commented on May 23, 2024

@thedustinsmith i m not able to fix it can u plz any other solution.

You can add you here in my site. http://www.askmedeveloper.com/

Thanks in advance.

from croppie.

Related Issues (20)

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.