Beispiel #1
0
	private IEnumerator _UpdatePlantPhoto ()
	{
		Texture2D texture;

		if (photoUrl == null || photoUrl.Length < 1)
		{
			texture = UtilsService.GetDefaultProfilePhoto();
		}
		else
		{
			var www = new WWW(photoUrl);
			yield return www;

			texture = UtilsService.ResizeTexture(www.texture, "Average", 0.25f);
		}

		if (texture == null)
			texture = UtilsService.GetDefaultProfilePhoto();

		photo.texture = texture;
	}
Beispiel #2
0
    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());
    }