matiasgali / guillotine

jQuery plugin to crop images within an area (fully responsive), allowing to drag (touch support), zoom and rotate.
http://guillotine.js.org
327 stars 100 forks source link

No way to restrict/warn for upscaling image pixels #51

Closed Luke-SF closed 8 years ago

Luke-SF commented 8 years ago

Guillotine by default lets you zoom in so far that the scale is >1. That forces Imagemagick or whatever you use to scale it, to basically upscale pixels that don't exist, making it at least a little pixellated. (WP image editor doesn't even let you upscale with the ->resize() command, giving "Could not calculate resized image dimensions".)

Can we have an option to show a warning or not permit scale >1 ?

matiasgali commented 8 years ago

You can easily prevent scale from being greater than 1 from the handler you bind to the zoom in button.

$('#zoom-in-button').click(function(){
  if (picture.guillotine('getData')['scale'] * 1.1 > 1) return;
  picture.guillotine('zoomIn');
});