private IEnumerator _GetPostImage() { string photoUrl = post.picture; Texture2D texture; if (photoUrl == null || photoUrl.Length < 1) { yield break; } Debug.Log("current post photo url is " + photoUrl); var www = new WWW(photoUrl); yield return(www); if (www.responseHeaders["STATUS"] != HTML.HTTP_200) { yield break; } texture = www.texture; if (texture == null) { Debug.LogError("Failed to load texture url: " + photoUrl); yield break; } Destroy(loadingHolder); imagePost.texture = texture; UtilsService.SizeToParent(imagePost, 0f); }
private IEnumerator _GetAuthorPhoto() { string photoUrl = post.author_photo; Texture2D texture; if (photoUrl == null || photoUrl.Length < 1) { texture = UtilsService.GetDefaultProfilePhoto(); } else { Debug.Log("Current author photo url is " + photoUrl); var www = new WWW(photoUrl); yield return(www); texture = www.texture; } if (texture == null) { texture = UtilsService.GetDefaultProfilePhoto(); } profilePic.texture = texture; UtilsService.SizeToParent(profilePic, 0f); }
public void CancelPhoto() { camService.resetFields("seeding_icon"); camService.pickPreiveimage.texture = originalPhoto; UtilsService.SizeToParent(camService.pickPreiveimage, 0f); }
public void CancelPhoto() { camService.resetFields("default_avatar"); camService.pickPreiveimage.texture = originalPhoto; UtilsService.SizeToParent(camService.pickPreiveimage, 0f); }
private IEnumerator LoadImage(string path) { var url = "file://" + path; #if UNITY_EDITOR || UNITY_STANDLONE url = "file:/" + path; #endif Debug.Log("current photo path is " + url); var www = new WWW(url); yield return(www); var texture = UtilsService.ResizeTexture(www.texture, "Average", 0.3f); texture.Apply(); if (texture == null) { Debug.LogError("Failed to load texture url:" + url); } pickPreiveimage.texture = texture; UtilsService.SizeToParent(pickPreiveimage, 0f); photoBase64 = System.Convert.ToBase64String(texture.EncodeToJPG()); }
public void Start() { currentImage = this.gameObject.GetComponent <RawImage>(); UtilsService.SizeToParent(currentImage, 0f); }