public void PickImage(int maxSize) { NativeGallery.Permission permission = NativeGallery.GetImageFromGallery((path) => { Debug.Log("Image path: " + path); if (path != null) { // Create Texture from selected image Texture2D tex = NativeGallery.LoadImageAtPath(path, maxSize); if (tex == null) { Debug.Log("Couldn't load texture from " + path); return; } Alert.Singleton.ShowAlert(Alert.Message.LOADING, false, delegate() { Debug.Log("Kauel: w:" + tex.width + "h:" + tex.height); int w = tex.width; int h = tex.height; if (w > h) { w = 1024; h = tex.height * w / tex.width; } else { h = 1024; w = tex.width * h / tex.height; } Texture2D resizedTex = tex.NewResizedTexture(w, h); // Destroy(tex); //Esta linea está a prueba. RawImageEdit.texture = resizedTex; Alert.Singleton.CloseAlert(true); TheKamera.StartFile(resizedTex); kuiPanelManager.ShowOnlyThisPanel(3); }); } }, "Select a PNG image", "image/png"); Debug.Log("Permission result: " + permission); }
public void OpenGallery() { Debug.Log("Kauel: OpenGallery External"); ImagePicker.OpenGallery((Texture2D tex, ExifOrientation orientation) => { Debug.Log("Kauel: OpenGallery Internal"); if (tex != null) { Alert.Singleton.ShowAlert(Alert.Message.LOADING, false, delegate() { Debug.Log("Kauel: w:" + tex.width + "h:" + tex.height); int w = tex.width; int h = tex.height; if (w > h) { w = 1024; h = tex.height * w / tex.width; } else { h = 1024; w = tex.width * h / tex.height; } Texture2D resizedTex = tex.NewResizedTexture(w, h); // Destroy(tex); //Esta linea está a prueba. RawImageEdit.texture = resizedTex; Alert.Singleton.CloseAlert(true); TheKamera.StartFile(resizedTex); kuiPanelManager.ShowOnlyThisPanel(3); }); } }, true, ImagePickerType.UIImagePickerControllerSourceTypePhotoLibrary); }