Yalantis / uCrop

Image Cropping Library for Android
https://yalantis.com/blog/introducing-ucrop-our-own-image-cropping-library-for-android/
11.86k stars 2.16k forks source link

Cropping options #131

Closed canberkcakmak closed 8 years ago

canberkcakmak commented 8 years ago

How can i disable only original cropping with options. using?

shliama commented 8 years ago

Currently you cannot do this. However I'm planning to add a feature so you can set your own selection of aspect ratio buttons in future update.

canberkcakmak commented 8 years ago

This is great. Thanks for answering. This is important because i have a project about photography and i think some users want to upload width :30px height:5000px photos for crashing to my app :). Have a nice day

shliama commented 8 years ago

@canberkcakmak please use library version 2.1.0 and Ucrop.Options.setAspectRatioOptions method :octocat:

canberkcakmak commented 8 years ago

Woow :) you re really perfect. I will try today. Thanks man :)

shliama commented 8 years ago

Thanks for using uCrop :)

Check out https://github.com/Yalantis/uCrop/blob/master/sample/src/main/java/com/yalantis/ucrop/sample/SampleActivity.java line 308 as a sample

canberkcakmak commented 8 years ago

Hi, i'm ,implement new version but, in the library build.gradle file compile 'com.android.support:appcompat-v7:24.0.0' gives error for my application. i'm using 23.2.1. When open the app in device it crashed and not give any log. Then i'm change my 23.2.1 to 24.0.0. but it gives same error. How can i solve this ? any suggestion. Thanks so much

shliama commented 8 years ago

@canberkcakmak I have a project with 23.4.0 version of appcompat & it runs well. I don't think that there are no error logs at all, maybe you have to change your logs level visibility etc. And of course, use clean.

Otherwise you can try to do this:

compile('com.android.support:appcompat-v7:23.2.1') {
    // force to use 23.2.1 even if another library resolves higher version
    force = true 
}
canberkcakmak commented 8 years ago

Ok. I download your library and implement manually my project and chage build.gradle with 23.2.1 it's perfectly worked. Thank you so much for update. :) have a nice day

shliama commented 8 years ago

(ノ◕ヮ◕)ノ*:・゚✧

canberkcakmak commented 8 years ago

sorry for open again :) and sorry for puzzling you. But my crop problem not solved i see. When i select my silly height photo firstly it shows original cropping. But when i clicked options it turns normal. here is my screenshot: http://i.hizliresim.com/l14lmp.png

shliama commented 8 years ago

Can you post here your uCrop config?

canberkcakmak commented 8 years ago

UCrop.Options options = new UCrop.Options(); options.setCompressionFormat(Bitmap.CompressFormat.JPEG); options.setCompressionQuality(100); options.setToolbarColor(context.getResources().getColor(R.color.white));

    options.setToolbarWidgetColor(context.getResources().getColor(R.color.black));
    options.setStatusBarColor(context.getResources().getColor(R.color.colorPrimaryDark));

    options.setAspectRatioOptions(1,
            new AspectRatio("1:2", 1, 2),
            new AspectRatio("3:4", 3, 4),
            new AspectRatio("5:3", 5, 3),
            new AspectRatio("16:9", 16, 9),
            new AspectRatio("1:1", 1, 1));

    UCrop.of(srcUri, destUri)
            .withOptions(options)
            .start(context);

here

shliama commented 8 years ago

Yei, you've found a bug :) Gonna push hotfix later today

canberkcakmak commented 8 years ago

:) okey. Again thanks for perfect crop library. I've tried almost all libraries and i think this is the best.

shliama commented 8 years ago

I've pushed an update 2.1.1 - above issue should be fixed :)

And by the way, if use api like this, library automatically makes same title from given numbers & swaps them if user clicks on it again.

options.setAspectRatioOptions(1,
            new AspectRatio(null, 1, 2),
            new AspectRatio(null, 3, 4),
            new AspectRatio(null, 5, 3),
            new AspectRatio(null, 16, 9),
            new AspectRatio(null, 1, 1));
canberkcakmak commented 8 years ago

it is working perfectly :) thanks man have a nice day.

haniha commented 7 years ago

And by the way, if use api like this, library automatically makes same title from given numbers & swaps them if user clicks on it again.

@shliama is there any option to disable swapping ?

meetVora1994 commented 6 years ago

How to enable free cropping?