acornejo / jquery-cropbox

jQuery Cropbox plugin
http://acornejo.github.io/jquery-cropbox/
MIT License
345 stars 82 forks source link

Increasing max zoom #4

Closed Sedins closed 10 years ago

Sedins commented 10 years ago

It doesn't seem possible to zoom in further than the size of the original image. I.e. having an 400x400 pixels image in a 200x200 pixels crop window will allow the max zoom to 2x, not to a defined number of max zoom like 5x or similar.

I re-size the image server-side to make it smaller (as I'm using effects and send the image to the client from time to time) for faster retrieval. Destination size could be about 800x600. Cropping is done on the original image server-side, so image quality is not that important in my case.

Thought about letting the browser re-size the image using CSS like -> style="width: 1400px; height: 1200px" as a workaround. It seems that only the height is allowed to re-size using cropbox, width is still unchanged, resulting in a stretched image.

Would it be possible to make cropbox zoom further into the image, or is there a workaround similar to the one I tried?

acornejo commented 10 years ago

The plugin doesn't currently support that.

You could easily workaround that restriction by resizing the image 2x in before feeding it into cropbox. Search for HTML5 canvas element to see what I'm talking about, or go here https://developer.mozilla.org/en-US/docs/HTML/Canvas for the reference (I don't think you will find a css work around btw).

I'll look into adding support for this later this week.

Sedins commented 10 years ago

Great! Checked the workaround and it seems like a very easy one as you said.

I'm in no hurry though as I have more things to implement as well. Following your project and keeping my fingers crossed that it isn't too much work to get the functionality directly in cropbox.

Thanks again for all the nice work with the plugin!

capri02 commented 10 years ago

Hi, First of all you really made a nice plugin. All functionality (crop, pan, zoom) is available in one plugin.

Right now I found that the image zoom option is not very scale able like Sedins mention in his comment. For me using canvas is not an option because a lot of other things happening with the image. Would be great if you extend the zooming option or could provide some tip to make it work.

acornejo commented 10 years ago

Hi,

Just to say that I plan to add a maxZoom option for you guys.

Its default value will be 1, which will result in the current behavior (which means you can't zoom past the point where you would be loosing image quality)

However, you can also set to larger values (say 1.5, 2, 3 or 10) which allows the user to zoom the image and start loosing quality.

Unfortunately my real job prevents from doing it now, but I hope this weekend I'll get some spare time to work on it. Pull-requests to add this option will be gladly accepted.

Sedins commented 10 years ago

I'm excited to hear you plan working on this feature. I'm not that familiar with the cropbox code myself and is also involved in another larger project besides my real job to be of any major help. Can help with testing or something other minor tasks if needed though.

Haven't been using github that much. What is a pull-request and how can that help you? I guess it involves in contributing a bit with coding?

acornejo commented 10 years ago

maxZoom feature has been added, try it out. image quality will inevitably decrease when using values greater than 1.

Closing this issue.