Coder Social home page Coder Social logo

stormlion227 / imagecropper.forms Goto Github PK

View Code? Open in Web Editor NEW
84.0 8.0 59.0 12.25 MB

Xamarin.Forms plugin to crop and rotate photos.

License: MIT License

C# 43.41% Objective-C 26.29% HTML 30.30%
xamarin-forms crop-image rotate-image android ios netstandard20 cropper nuget-package plugin image-cropper

imagecropper.forms's Introduction

ImageCropper.Forms

Xamarin.Forms plugin to crop and rotate photos.

NuGet

Supports Android and iOS.

Features

  • Cropping image.
  • Rotating image.
  • Aspect ratio.
  • Circle/Rectangle shape.

Screen-Shots

Android

Crop/Rotate image(Rectangle/Android) Crop/Rotate image(Circle/Android)

iOS

Crop/Rotate image(Rectangle/iOS) Crop/Rotate image(Circle/iOS)

Setup

Android

Add the following to your AndroidManifest.xml inside the tags:

	<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
	          android:theme="@style/Base.Theme.AppCompat"/>	

In MainActivity.cs file:

    Stormlion.ImageCropper.Droid.Platform.Init();

    global::Xamarin.Forms.Forms.Init(this, bundle);
    protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
        base.OnActivityResult(requestCode, resultCode, data);

        Stormlion.ImageCropper.Droid.Platform.OnActivityResult(requestCode, resultCode, data);
    }

iOS

In AppDelegate.cs file:

    Stormlion.ImageCropper.iOS.Platform.Init();

Usage

Show ImageCropper page.

    new ImageCropper()
    {
        Success = (imageFile) =>
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                imageView.Source = ImageSource.FromFile(imageFile);
            });
        }
    }.Show(this);

Show it with additional parameters.

    new ImageCropper()
    {
        PageTitle = "Test Title",
        AspectRatioX = 1,
        AspectRatioY = 1,
	CropShape = ImageCropper.CropShapeType.Oval,
	SelectSourceTitle = "Select source",
	TakePhotoTitle = "Take Photo",
	PhotoLibraryTitle = "Photo Library",
	CancelButtonTitle = "Cancel",
        Success = (imageFile) =>
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                imageView.Source = ImageSource.FromFile(imageFile);
            });
        }
    }.Show(this);

Show it with a image

    new ImageCropper()
    {
        Success = (imageFile) =>
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                imageView.Source = ImageSource.FromFile(imageFile);
            });
        }
    }.Show(this, imageFileName);

Get byte[] from image file

var imageBytes = ImageCropper.Current.GetBytes(imageFile: imageFile);

Properties

  • PageTitle
  • AspectRatioX
  • AspectRatioY
  • CropShape
  • Initial image can be set in Show function.

Contributions

Contributions are welcome!

imagecropper.forms's People

Contributors

inhack20 avatar kelderth avatar kennydinh avatar kennydizi avatar rasmusbjoernrasmussen avatar servin-osmanov avatar stormlion227 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagecropper.forms's Issues

Not able to release app with link skds assembly

Error XALNK7000: Mono.Linker.MarkException: Error processing method: 'System.Void LetsConnect123.Fragment.RecordVideo/d__12::MoveNext()' in assembly: '
LetsConnect123.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve
System.Threading.Tasks.Task`1<Plugin.Media.Abstractions.MediaFile> Plugin.Media.Abstractions.IMedia::TakeVideoAsync(Plugin.Media.Abstractions.StoreVideoOptions)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod (Mono.Cecil.MethodReference reference) [0x00013] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference) [0x00049] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction) [0x00040] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x000c2] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x001b1] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x0001b] in <3e53085892e04b628169d0ea2d9ff8b6>:0
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00047] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue () [0x0000a] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.Process () [0x000f6] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000d] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at MonoDroid.Tuner.MonoDroidMarkStep.Process (Mono.Linker.LinkContext context) [0x0000b] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Pipeline.ProcessStep (Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) [0x0000d] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0000f] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x001dd] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Xamarin.Android.Tasks.LinkAssemblies.RunTask () [0x0001b] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Xamarin.Android.Tasks.AndroidTask.Execute () [0x00000] in <3e53085892e04b628169d0ea2d9ff8b6>:0 (XALNK7000) (LetsConnect123.Android)

Not an Issue but a easy new feature

It would be cool that we could set the image size and the image compression when taking the photo with CrossMedia.
Would like to have two new properties on ImageCropper that will set the image size and image compression.

var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{
PhotoSize = PhotoSize.Medium,
CompressionQuality = 80,
});

Solution using ImageCropper.Forms doesn't compiles in release mode

Everything works in debug mode but when I try to archive to get the release apk file it gives this error message:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(5,5): Error XALNK7000: Mono.Linker.MarkException: Error processing method: 'System.Void Stormlion.ImageCropper.ImageCropper/d__43::MoveNext()' in assembly: 'Stormlion.ImageCropper.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Threading.Tasks.Task`1<Plugin.Media.Abstractions.MediaFile> Plugin.Media.Abstractions.IMedia::TakePhotoAsync(Plugin.Media.Abstractions.StoreCameraMediaOptions)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod (Mono.Cecil.MethodReference reference) [0x00013] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference) [0x0004a] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction) [0x00040] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x000c2] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00186] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x0001b] in <82010c32869043cdad86578a8131c7e9>:0
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00047] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue () [0x0000a] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Steps.MarkStep.Process () [0x00102] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000d] in <82010c32869043cdad86578a8131c7e9>:0
at MonoDroid.Tuner.MonoDroidMarkStep.Process (Mono.Linker.LinkContext context) [0x0000b] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Pipeline.ProcessStep (Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) [0x0000d] in <82010c32869043cdad86578a8131c7e9>:0
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0000f] in <82010c32869043cdad86578a8131c7e9>:0
at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <82010c32869043cdad86578a8131c7e9>:0
at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <82010c32869043cdad86578a8131c7e9>:0
at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x001dd] in <82010c32869043cdad86578a8131c7e9>:0
at Xamarin.Android.Tasks.LinkAssemblies.RunTask () [0x0001b] in <82010c32869043cdad86578a8131c7e9>:0
at Xamarin.Android.Tasks.AndroidTask.Execute () [0x00000] in <82010c32869043cdad86578a8131c7e9>:0 (XALNK7000) (MasterDetailPageNavigation.Droid)

Does anyone knows how to fix that?

Not work with Plugin.Media v 5.0.1

    <PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
    <PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" />

I have upgraded Plugin.Media to v 5.0.1
And it removed following libraries while upgrading

src\MyAppMobile

Uninstalling:
Plugin.Permissions.3.0.0.12

Updates:
Xam.Plugin.Media.4.0.1.5 -> Xam.Plugin.Media.5.0.1
src\MyAppMobile.iOS\MyAppMobile.iOS.csproj

Uninstalling:
Plugin.Permissions.3.0.0.12

Updates:
Xam.Plugin.Media.4.0.1.5 -> Xam.Plugin.Media.5.0.1
src\MyAppMobile.Android\MyAppMobile.Android.csproj

Uninstalling:
Plugin.CurrentActivity.2.1.0.2
Plugin.Permissions.3.0.0.12

Updates:
Xam.Plugin.Media.4.0.1.5 -> Xam.Plugin.Media.5.0.1

Then I removed the references of Plugin.CurrentActivity and Plugin.Permissions .

after that , when I was running the project, I'm having following error ..

Can not resolve reference: Plugin.CurrentActivity, referenced by Stormlion.ImageCropper.Android. Please add a NuGet package or assembly reference for Plugin.CurrentActivity, or remove the reference to Stormlion.ImageCropper.Android. MyAppMobile.Android

Cropper page doesn't show on Modal page iOS.

I've encountered this issue before where presenting a ViewController from native iOS in a xamarin.forms app... if the current page is pushed modally then the ViewController wont show up.

The fix is in this line:

UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(cropViewController, true, null);

please use this bit of code instead:

        UIWindow window = UIApplication.SharedApplication.KeyWindow;
        UIViewController viewController = window.RootViewController;

        while (viewController.PresentedViewController != null)
        {
            viewController = viewController.PresentedViewController;
        }
        viewController.PresentViewController(cropViewController, true, null);

ANDROID: Cropping Page doenst load unless fix V2 is used (non of the others work, but V2 cant load the camera)

Im doing this:

await new ImageCropper()
{
PageTitle = "Test Title",
AspectRatioX = 1,
AspectRatioY = 1,
CropShape = ImageCropper.CropShapeType.Rectangle,
SelectSourceTitle = "Select source",
TakePhotoTitle = "Take Photo",
PhotoLibraryTitle = "Photo Library",
CancelButtonTitle = "Cancel",
Success = (imageFile) =>
{
Device.BeginInvokeOnMainThread(() =>
{
img_eventPic.Source = ImageSource.FromFile(imageFile);
});
}
}.Show(this);

And I am not getting the cropping page to load. I can pick an image from the gallery or make a photo on v6 but the page doenst load unless im using fix v2 :(

An error on ios

After pick or take photo, nothing show up on ios.
It working fine on android, please help~

[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
Warning: Attempt to present <TOCropViewController: 0x7ff032b99000> on <Xamarin_Forms_Platform_iOS_PlatformRenderer: 0x7ff030cdd130> whose view is not in the window hierarchy!

iOS crop not working

i have added this line in ios project "Platform.Init();" And it was working fine.
Suddenly it is not working. I am calling below funtion:
new ImageCropper()
{
AspectRatioX = 1,
AspectRatioY =1,
Success = (imageFile) =>
{
Device.BeginInvokeOnMainThread(() =>
{
Console.WriteLine("--FILE-->" + imageFile);

                    });
                }
            }.Show(this, SelectedImage);

Please suggest any solution. thanks in advance

Update to Xamarin.Android.Support.Exif.28.0.0.3

Versions Conflict for "Xamarin.Android.Support.Annotations"

MYAPP.Android -> Xamarin.Forms 4.5.0.396 -> Xamarin.Android.Support.v4 28.0.0.3 -> Xamarin.Android.Support.Media.Compat 28.0.0.3 -> Xamarin.Android.Support.Annotations (= 28.0.0.3)

MYAPP -> ImageCropper.Forms 0.1.6 -> Xamarin.Android.Support.Exif 27.0.2 -> Xamarin.Android.Support.Annotations (= 27.0.2).

In your ImageCropper.nuspec you have:

In other Files you go for: Xamarin.Android.Support.Exif.28.0.0.1

Can you update all the Support Libraries to 28.0.0.3 and Xamarin.Forms to the most recent version?

Thank you very much!

ImageCropper.Forms is not working in ios platform (System.MissingMethodException)

I am using ImageCropper.Forms package for cropping images. It is working fine on the android part but when I try it on ios, I am getting the below exception:

Exception:>System.MissingMethodException: Method not found: System.Threading.Tasks.Task`1<Plugin.Media.Abstractions.MediaFile> Plugin.Media.Abstractions.IMedia.TakePhotoAsync(Plugin.Media.Abstractions.StoreCameraMediaOptions)
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:84
at Stormlion.ImageCropper.ImageCropper.Show (Xamarin.Forms.Page page, System.String imageFile) [0x00033] in <548dc893a11b47fe908c9c3d7f4a39ba>:0
at ImageCropDemo.MainPage.OnClickedRectangle (System.Object sender, System.EventArgs e) [0x00002] in /Users/companyname/Downloads/ImageCropDemo/ImageCropDemo/ImageCropDemo/MainPage.xaml.cs:29

My Code

try
{
	new ImageCropper()
	{
		Success = (imageFile) =>
		{
			Device.BeginInvokeOnMainThread(() =>
			{
				image.Source = ImageSource.FromFile(imageFile);
			});
		}
	}.Show(this);
}
catch (Exception ex)
{
	System.Diagnostics.Debug.WriteLine("Exception:>" + ex);
}

I tried to install ImageCropper.Forms.Fix.v3 to solve this issue. When I try to install Fix.v3 getting the below errors:

Severity Code Description Project File Line Suppression State
Error NU1101 Unable to find package Plugin.Persmissions. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org ImageCropDemo C:\Users\user\Downloads\ImageCropDemo\ImageCropDemo\ImageCropDemo\ImageCropDemo.csproj 1=
Error Package restore failed. Rolling back package changes for 'ImageCropDemo'.

The ImageCropper.Forms.Fix.v5 installation is success, but no change in the exception. ImageCropper.Forms.Fix.v6 and ImageCropper.Forms.Fix.v7 packages are also available, which package will solve this issue in ios?

Duplicate java found

Keep getting this error can't compile because of it, any help?

Duplicate Java type found! Mappings between managed types and Java types must be unique. First Type: 'Com.Theartofdev.Edmodo.Cropper.CropImageView+IOnSetImageUriCompleteListenerImplementor, Binding_AndroidImageCropper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Second Type: 'Xamarin.Android.ImageCropper.CropImageView+IOnSetImageUriCompleteListenerImplementor, Xamarin.Android.ImageCropper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ParTimers.Android

ImageCropper.Forms: How to remove the multiple pop-up?

I am using ImageCropper.Forms for cropping the image selected from the camera and gallery. I have 3 options for changing a profile picture; Take Photo, Upload from Gallery and Select Avatar. So for showing the Media options I am using a DisplayActionSheet like below:

var actionSheet = await DisplayActionSheet(null,"Cancel", null, "Take Photo", "Upload from Gallery", "Select Avatar");
if (actionSheet == "Take Photo")
{
	OpenCamera();
}
else if(actionSheet == "Upload from Gallery")
{
	Opengallery();
}
else if(actionSheet == "Select Avatar")
{
	OpenAvatar();
}

OpenCamera() and Opengallery() are added below. That code is also asking the Take Photo and Photo Library options again as a popup. I don't need that pop up, is there any way to remove the second popup asked by ImageCropper.Forms and load the camera or gallery directly?

My Code:

    async void OpenCamera()
	{
		try
		{
			await CrossMedia.Current.Initialize();
            //I need to open camera only here, no need of a pop up again.
			new ImageCropper()
			{
				PageTitle = "Test Title",
				AspectRatioX = 1,
				AspectRatioY = 1,
				CropShape = ImageCropper.CropShapeType.Rectangle,
				SelectSourceTitle = "Select source",
				TakePhotoTitle = "Take Photo",
				PhotoLibraryTitle = "Photo Library",
				Success = (imageFile) =>
				{
					Device.BeginInvokeOnMainThread(() =>
					{
						profilephoto.Source = ImageSource.FromFile(imageFile);
					});
				}
			}.Show(this);
		}
		catch (Exception ex)
		{
			System.Diagnostics.Debug.WriteLine("CameraException:>" + ex);
		}
	}

async void Opengallery()
{
	try
	{
		await CrossMedia.Current.Initialize();
        //I need to open gallery only here, no need of a pop up again.
		new ImageCropper()
		{
			PageTitle = "Test Title",
			AspectRatioX = 1,
			AspectRatioY = 1,
			CropShape = ImageCropper.CropShapeType.Rectangle,
			SelectSourceTitle = "Select source",
			TakePhotoTitle = "Take Photo",
			PhotoLibraryTitle = "Photo Library",
			Success = (imageFile) =>
			{
				Device.BeginInvokeOnMainThread(() =>
				{
					profilephoto.Source = ImageSource.FromFile(imageFile);
					//var stream = ImageSource.FromFile(imageFile);
					//imagefile = imageFile;
				});
			}
		}.Show(this);
	}
}

Screenshot: https://i.stack.imgur.com/qYBuu.jpg

Is there any way to separate camera and gallery code like MediaPlugin?

I can't run in VS 2019.16.9.5.

Hi, I can't run in VS 2019.16.9.5. How to run this project?

Thank you.

Error is

  1. Severity Code Description Project File Line Suppression State
    Error The Java type mono.com.theartofdev.edmodo.cropper.CropOverlayView_CropWindowChangeListenerImplementor is generated by more than one managed type. Please change the [Register] attribute so that the same Java type is not emitted. Test.Android
  2. Severity Code Description Project File Line Suppression State
    Error mono.com.theartofdev.edmodo.cropper.CropOverlayView_CropWindowChangeListenerImplementor generated by: Com.Theartofdev.Edmodo.Cropper.CropOverlayView+ICropWindowChangeListenerImplementor, Binding_AndroidImageCropper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Test.Android
  3. Severity Code Description Project File Line Suppression State
    Error mono.com.theartofdev.edmodo.cropper.CropOverlayView_CropWindowChangeListenerImplementor generated by: Com.Theartofdev.Edmodo.Cropper.CropOverlayView+ICropWindowChangeListenerImplementor, XamarinAndroidImageCropper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Test.Android

PNG and Transparency

Hello,
I'm trying to crop PNG images containing transparency using ImageCropper.
But cropped image transparency is replaced by a black color.
It is possible to keep the transparency in the cropped image ?

For info, i'm calling the image cropper like this.

var cropper = new ImageCropper() { AspectRatioX = 1, AspectRatioY = 1, CancelButtonTitle = Resources_Strings.Generic_Cancel, CropMenuCropButtonTitle = Resources_Strings.ImageCropper_CropMenuCropButtonTitle, DoneButtonTitle = Resources_Strings.ImageCropper_DoneButtonTitle, PageTitle = Resources_Strings.ImageCropper_PageTitle, PhotoLibraryTitle = Resources_Strings.ImageCropper_PhotoLibraryTitle, SelectSourceTitle = Resources_Strings.ImageCropper_SelectSourceTitle, TakePhotoTitle = Resources_Strings.ImageCropper_TakePhotoTitle, Faiure = () => { // Cancel was requested by user. }, Success = successAction }; cropper.Show(this);

Thanks !

How to run in iOS?

Hi,

I created a new project and installed version 0.1.4 via nuget, but I'm getting these errors when building the iOS project. I tried building it using VS2017 connecting to mac and also building it using VS for Mac. Am I missing something?

5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed, undefined Objective-C class: TOCropView. The symbol '_OBJC_CLASS_$_TOCropView' could not be found in any of the libraries or frameworks linked with your application. 5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed, undefined Objective-C class: TOCropViewControllerTransitioning. The symbol '_OBJC_CLASS_$_TOCropViewControllerTransitioning' could not be found in any of the libraries or frameworks linked with your application. 5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed, undefined Objective-C class: TOCropScrollView. The symbol '_OBJC_CLASS_$_TOCropScrollView' could not be found in any of the libraries or frameworks linked with your application. 5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed, undefined Objective-C class: TOCroppedImageAttributes. The symbol '_OBJC_CLASS_$_TOCroppedImageAttributes' could not be found in any of the libraries or frameworks linked with your application. 5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed, undefined Objective-C class: TOCropToolbar. The symbol '_OBJC_CLASS_$_TOCropToolbar' could not be found in any of the libraries or frameworks linked with your application. 5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed, undefined Objective-C class: TOCropOverlayView. The symbol '_OBJC_CLASS_$_TOCropOverlayView' could not be found in any of the libraries or frameworks linked with your application. 5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed, undefined Objective-C class: TOCropViewController. The symbol '_OBJC_CLASS_$_TOCropViewController' could not be found in any of the libraries or frameworks linked with your application. 5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed, undefined Objective-C class: TOActivityCroppedImageProvider. The symbol '_OBJC_CLASS_$_TOActivityCroppedImageProvider' could not be found in any of the libraries or frameworks linked with your application. 5>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(786,3): error : Native linking failed. Please review the build log.

Thanks for your help.

taking image crashes in LG phones

when I take images in lg phones after taping the shatter button I get 'unfortunately, camera has stopped'

I updated all the nuggets.
the odd thing is that it works on android devices from different manufactures

please help, not working on ios

I added the line Stormlion.ImageCropper.iOS.Platform.Init(); in AppDelegate and when I want to take a picture, it shows the camare, take the picture and nothing else happen, is not showing the tool, could you please help me? thanks

Support for Maui

I wonder is this plugin going to support MAUI?

Since, the plugin is useful in my application on Xamarin platform. Thanks.

iOS building issue on v0.1.4

I get this error when I build v0.1.4 but not on v0.1.3 -->

Can't resolve the reference 'System.Void ObjCRuntime.BlockLiteral::SetupBlockUnsafe(System.Delegate,System.Delegate)', referenced from the method 'System.Void Bind_TOCropViewController.TOCropScrollView::set_TouchesBegan(System.Action)' in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.

Adding ImageCropper.Forms to my iOS project breaks our Apple Store deployment

This is a bizarre one, but using ImageCropper.Forms.Fix.v2 nuget package version 1.1.5 breaks our iOS deployment, specifically using Azure DevOps. With no other changes (isolated specifically to this commit adding the image cropper), our fastlane deployment projects no longer seem to have Asset Catalogs configured correctly. Our assets catalogs / ipa files build fine without ImageCropper. My only guess is whatever iOS specific dependency is used for image cropping is messing with our asset catalogs somehow.

2021-12-02T15:16:55.5956800Z [15:16:55]: ERROR ITMS-90022: "Missing required icon file. The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format for iOS versions >= 7.0. To support older versions of iOS, the icon may be required in the bundle outside of an asset catalog. Make sure the Info.plist file includes appropriate entries referencing the file. See https://developer.apple.com/documentation/bundleresources/information_property_list/user_interface" 2021-12-02T15:16:55.6060690Z ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '76x76' pixels, in .png format for iOS versions >= 7.0. To support older operating systems, the icon may be required in the bundle outside of an asset catalog. Make sure the Info.plist file includes appropriate entries referencing the file. See https://developer.apple.com/documentation/bundleresources/information_property_list/user_interface" 2021-12-02T15:16:55.6168670Z ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '167x167' pixels, in .png format for iOS versions supporting iPad Pro. To support older operating systems, the icon may be required in the bundle outside of an asset catalog. Make sure the Info.plist file includes appropriate entries referencing the file. See https://developer.apple.com/documentation/bundleresources/information_property_list/user_interface" 2021-12-02T15:16:55.6176460Z ERROR ITMS-90023: "Missing required icon file. The bundle does not contain an app icon for iPad of exactly '152x152' pixels, in .png format for iOS versions >= 7.0. To support older operating systems, the icon may be required in the bundle outside of an asset catalog. Make sure the Info.plist file includes appropriate entries referencing the file. See https://developer.apple.com/documentation/bundleresources/information_property_list/user_interface" 2021-12-02T15:16:55.6281800Z ERROR ITMS-90704: "Missing App Icon. An app icon measuring 1024 by 1024 pixels in PNG format must be included in the Asset Catalog of apps built for iOS, iPadOS, or watchOS. Without this icon, apps cannot be submitted for review. For details, see https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/." 2021-12-02T15:16:55.7127900Z [15:16:55]: [iTMSTransporter] [2021-12-02 15:16:55 UTC] <main> DBG-X: The error code is: 1102

UI Customization for cropping.

Hi,

I've tried the package in Xamarin Forms project and it is working good. We would like to add this functionality to custom activity, where we want to customize the cropping layout to have some text.
Is there anyway we can customize the activity to add few more controls on the screen?
desiredcropping

Null Reference Exception After taking photo on Android

I downloaded and built the library and it works fine on iOS, but I"m getting a null reference exception on Android. It happens right after a photo is taken or chosen (so I never see the "use photo" screen). I'm targeting Android 8.0, but otherwise I haven't changed anything. Any thoughts?

Here's the exception from the log. I'll attach the full output as a file.

Unhandled Exception:

Java.Lang.RuntimeException: Unable to start activity ComponentInfo{com.stormlion.ImageCropperTest/com.theartofdev.edmodo.cropper.CropImageActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void android.support.v7.widget.DecorContentParent.setWindowCallback(android.view.Window$Callback)' on a null object reference

03-07 18:26:42.002 E/AndroidRuntime( 5357): FATAL EXCEPTION: main
03-07 18:26:42.002 E/AndroidRuntime( 5357): Process: com.stormlion.ImageCropperTest, PID: 5357
03-07 18:26:42.002 E/AndroidRuntime( 5357): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.stormlion.ImageCropperTest/com.theartofdev.edmodo.cropper.CropImageActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void android.support.v7.widget.DecorContentParent.setWindowCallback(android.view.Window$Callback)' on a null object reference
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2697)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2771)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.app.ActivityThread.access$900(ActivityThread.java:177)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1432)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.os.Handler.dispatchMessage(Handler.java:102)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.os.Looper.loop(Looper.java:135)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.app.ActivityThread.main(ActivityThread.java:5912)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at java.lang.reflect.Method.invoke(Native Method)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at java.lang.reflect.Method.invoke(Method.java:372)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
03-07 18:26:42.002 E/AndroidRuntime( 5357): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void android.support.v7.widget.DecorContentParent.setWindowCallback(android.view.Window$Callback)' on a null object reference
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:410)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at com.theartofdev.edmodo.cropper.CropImageActivity.onCreate(CropImageActivity.java:58)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.app.Activity.performCreate(Activity.java:6178)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
03-07 18:26:42.002 E/AndroidRuntime( 5357): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2650)
03-07 18:26:42.002 E/AndroidRuntime( 5357): ... 10 more
Thread finished: #3
The thread 0x3 has exited with code 0 (0x0).
outputlog.txt

App crashes on creating new instance of ImageCropper

When calling

new ImageCropper() { PageTitle = "Cut an image", AspectRatioX = 1, AspectRatioY = 1, CropShape = ImageCropper.CropShapeType.Rectangle, SelectSourceTitle = "Select a file", TakePhotoTitle = "Take a picture", PhotoLibraryTitle = "Pic gallery", Success = (imageFile) => { Device.BeginInvokeOnMainThread(() => { imageView.Source = ImageSource.FromFile(imageFile); }); } }.Show(this);

This exception is threw:

Method not found: System.Threading.Tasks.Task`1<Plugin.Media.Abstractions.MediaFile> Plugin.Media.Abstractions.IMedia.TakePhotoAsync(Plugin.Media.Abstractions.StoreCameraMediaOptions)

ImageCropper 1.0.6
Xam.Plugin.Media 5.0.1
Xamarin.Android.Support.* 28.0.0.3
Xamarin.Essentials 1.5.4.2
Xamarin.Forms 4.7.0.1080

Navigation bar title is getting cut in android devices.

The title shown in the navigation bar is getting cut in android devices. The text we've given is "Align your face properly". But in ios its working fine as it doesn't have the option to rotate and done buttons are not shown in ios navigation title bar. Could you please provide a solution for the navigation title text cut issue in android?

issue nugets install in .net standard

how we can install this nugets in xamarin.forms .net standard version. it show error while installing in xamarin.forms Package restore failed. Rolling back package changes for 'ImageCropperExample1.Android'.
Please help me regarding this issue i tried many but some install and some give this issue.

Take photo functionality is not working after changing the target version to 13 and api level 33.

I recently updated the Android target version from 12 to 13 in our Xamarin Android app. The photo upload functionality is functioning correctly, but I am encountering issues with the 'take a photo' feature. Despite numerous attempts, nothing happens when I click on it. I have tested this on an Android emulator with Android version 13 and API level 33. Are there any solutions available for this bug now?

Android version: 13
plugin version : 1.0.7

iOS image assets don't compile

Hi,

The plugin is working great but the first time I build the project in iOS the images aren't compiled. The second try the images will compile but never on a fresh install. This is a problem for me because I want to use continuous build integration.

Do you have any idea what the problem could be?

Forcing a cropping style

Hi, I was wondering if it's possible to force one of the available cropping styles (such as Square) upon entering the Image Cropper. That would be a very useful feature for me.

Plugin is not working if Plugin.Permissions is updated to v3.0.0.12

I'm using ImageCropper.Forms in my project, version 0.1.4.

The problem arises when trying to update Plugin.Permissions from version 2.2.1 to version 3.0.0.12 (lastest release), Visual Studio throws and exception saying that Plugin.Permissions.Abstractions cannot be found...

Any solutions?

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.