andrefarzat / ng-jcrop

Angular directive to jCrop jQuery plugin
GNU General Public License v2.0
101 stars 39 forks source link

Change Aspect Ratio #30

Closed stanleygomes closed 9 years ago

stanleygomes commented 9 years ago

Hello My friend,

i use the jCrop in my angular app and in multiple different controllers, for each one I need a different configuration, but I only found this config on my app.config:

ngJcropConfigProvider.setJcropConfig({

How can I do for example:

myapp.controller("controller1", ...{ //crop image square }

myapp.controller("controller2", ...{ //crop image panoramic }

myapp.controller("controller3", ...{ //crop image 16/9 }

etc.

Sorry for my english and if the question is stupid.

Thanks!

andrefarzat commented 9 years ago

That's not a stupid question at all, my friend. And unfortunately, the ngJcrop was designed to work with only one configuration per app ( my bad on that =F ).

Do you think it would be a good addition ? Something like

<script>
// This code in a file
app.controller('SomeController', function($scope){
    $scope.obj = {}

    // The url or the data64 for the image
    $scope.obj.src = 'beautifulImage.jpg';

    // The config which will overwritten the Default Config
    $scope.obj.config = { aspectRatio: 'your ratio here' };

    // Must be [x, y, x2, y2, w, h]
    $scope.obj.coords = [100, 100, 200, 200, 100, 100];

    // You can add a thumbnail if you want
    $scope.obj.thumbnail = true;
});
</script>
<div ng-jcrop="obj.src" ng-jcrop-config="obj.config" selection="obj.coords" thumbnail="obj.thumbnail"></div>

If you think we should implement it, please re-open this issue. p.s.: Não vi nenhum problema no teu inglês :smiley_cat:

stanleygomes commented 9 years ago

Hello,

I used multiple ng-app to manipulate different configurations.

If the community needs this feature, You may implement it, but it's no so essencial.

Thanks.

zjkyz8 commented 9 years ago

hey, my friend, I also face this problem, and it is different for me to use multiple ng-app to manage different config, so this feature is very import for me, can you implement it. I am very appreciate it. :)