protected void Page_Load(object sender, EventArgs e) { // //TODO 頁面載入 // //取消使用UnobtrusiveValidationMode驗證 UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; //使用初始圖片避免資料庫沒有圖片 // str_tempPath = "~/img/heavy-plus-sign.png"; //使用初始設定副程式 init(); //分割從資料庫加入的字串 str_imgPath = str_tempPath.Split(separators, StringSplitOptions.RemoveEmptyEntries); //將物件加入版面 PhotoPicker pp_temp = new PhotoPicker(str_imgPath); pp_select = pp_temp; pp_select.int_pictureGrid = 4; UpdatePanel1.ContentTemplateContainer.Controls.Add(pp_select); int_insertImg = pp_select.int_nowPickId; pp_select.init(); }
public static PhotoPicker GetInstance() { if (instance == null) { instance = new PhotoPicker(); } return(instance); }
void Start() { //handle Image data returned from Plugin PhotoPicker photoPicker = PhotoPicker.Instance; photoPicker.SetCropSize(256, 256); photoPicker.SetCropFileName(destImageName); photoPicker.onImageReceived_android = OnImageReceived_android; photoPicker.onImageReceived_iOS = OnImageReceived_iOS; }
private async Task <SoftwareBitmap> TakePhoto(bool fromFile = false) { if (!fromFile) { return(await TakePhotoFromCamera()); } var picker = new PhotoPicker(); var rawPicture = await picker.SelectPhoto(); if (rawPicture == null) { return(null); } return(await PictureConverter.DecodeToBitmap(rawPicture)); }
private void Start() { PhotoPicker picker = PhotoPicker.Instance; picker.SetGameObjectName(gameObject.name); if (openGalleryButton != null) { openGalleryButton.onClick.AddListener(picker.OpenGallery); } if (takePhotoButton != null) { takePhotoButton.onClick.AddListener(picker.OpenGallery); } if (cancelButton != null) { cancelButton.onClick.AddListener(() => { gameObject.SetActive(false); }); } }
void OnImageReceived_android(ImageData data) { Debug.LogError("OnImageReceived"); JpegInfo jpegInfo = ExifReader.ReadJpegFromBytes(data.data, ""); Debug.LogError("jpegInfo.IsValid=" + jpegInfo.IsValid + " " + jpegInfo.Width + " " + jpegInfo.Height); Debug.LogError("jpegInfo.Orientation=" + jpegInfo.Orientation); Debug.LogError("width=" + data.width + " height=" + data.height); Debug.LogError("filePath=" + data.filePath); Debug.LogError("Application.persistentDataPath=" + Application.persistentDataPath); SetImageTexture(PhotoPicker.GetTexture2DFromImageData(data)); imagePath = data.filePath; if (!File.Exists(imagePath)) { File.WriteAllBytes(imagePath, data.data); } }
protected override void OnElementChanged(VisualElementChangedEventArgs e) { base.OnElementChanged(e); if (e.OldElement != null || Element == null) { return; } PhotoPicker = this.Element as PhotoPicker; var controller = UIApplication.SharedApplication.KeyWindow.RootViewController; var img = UIImage.FromFile(PhotoPicker.Path); var width = View.Frame.Width - 40; var cropperController = new ClipImageView.VPImageCropperViewController(img, new CGRect(20f, (View.Frame.Height - width) / 2f, width, width), 3); cropperController.Delegate = new VPImageCropperViewControllerDelegete(); controller.PresentViewController(cropperController, true, null); }