public bool Upload(string imageBase64, string qrCode) { // Se obtiene el directorio virtual en donde se encuentra la App string basePath = Server.MapPath("~/"); // Se sube la imagen return(PhotoServices.UploadImage(imageBase64, basePath, qrCode)); }
/// <summary> /// Page Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { // Si es la primera vez que se carga, se genera un nuevo Id para el código QR y se guarda la // imagen en el servidor if (!IsPostBack) { string qrCode = PhotoServices.CreateImage(); this.qrImage.ImageUrl = PhotoServices.CreateQr(qrCode, Server.MapPath("~/")); } }
public JsonResult GetPhotosByAlbumId([FromQuery(Name = "Id")] int Id) { var photosResult = new List <Photo>(); try { //Get all photos from the services by album photosResult = PhotoServices.GetPhotosByAlbumId(Id); return(Json(new { message = MessagesHelper.TextMsg, type = MessagesHelper.success, photosResult })); } catch (Exception ex) { return(Json(new { message = MessagesHelper.TextMsg, type = MessagesHelper.warning, photosResult })); } }
void Start() { float str2 = PlayerPrefs.GetFloat("DistanceTraveled"); int str3 = PlayerPrefs.GetInt("MyShot"); DistanceText.text = Mathf.Round(str2).ToString(); ShotTakenText.text = str3.ToString(); BinaryFormatter bf = new BinaryFormatter(); DirectoryInfo dir = new DirectoryInfo(GetAndroidExternalStoragePath() + "/" + Application.productName + " Captures"); if (!Directory.Exists(GetAndroidExternalStoragePath() + "/" + Application.productName + " Captures")) { var folder = Directory.CreateDirectory(GetAndroidExternalStoragePath() + "/" + Application.productName + " Captures"); } var files = dir.GetFiles().Where(o => o.Name.EndsWith(".png")).ToArray(); for (int i = 0; i < files.Length; i++) { float PixelsPerUnit = 100.0f; SpriteMeshType spriteType = SpriteMeshType.Tight; Texture2D SpriteTexture = LoadTexture(files[i].FullName); Sprite NewSprite = Sprite.Create(SpriteTexture, new Rect(0, 0, SpriteTexture.width, SpriteTexture.height), new Vector2(0, 0), PixelsPerUnit, 0, spriteType); PhotoServices imagefile = new PhotoServices(); imagefile.photosTexture = NewSprite; imagefile.photoId = i; imagefile.photosName = files[i].Name.ToString(); imagefile.sharedPhotos = false; PhotosLoaded.Add(imagefile); myPhotoPreview = Instantiate(PhotoPrefabs, GalleryManager.MyInstance.transform).GetComponent <GalerryView>(); //AllFiles[i] = (FileModel)bf.Deserialize(fs); myPhotoPreview.PhotoMiniPreview.sprite = PhotosLoaded[i].photosTexture; myPhotoPreview.PhotoName.text = PhotosLoaded[i].photosName.Replace(".png", ""); myPhotoPreview.PhotoId = PhotosLoaded[i].photoId; myPhotoPreview.sharedPhotos = PhotosLoaded[i].sharedPhotos; } }
public async Task <JsonResult> UploadPhotoServices(IFormFile file, [FromQuery] int id, [FromHeader] string Authorization) { var responce = await _imageHandler.UploadUserpic(file); if (responce[0] == "OK") { PhotoServices userpic = new PhotoServices { path = responce[2], name = responce[1], dttmadd = DateTime.UtcNow, id = id, id_service = id }; await _context.photoServices.AddAsync(userpic); await _context.SaveChangesAsync(); return(new JsonResult(_responce.Return_Responce(System.Net.HttpStatusCode.OK, null, "Изображение сохранено"))); } return(new JsonResult(_responce.Return_Responce(System.Net.HttpStatusCode.BadRequest, null, responce[0]))); }
public PostViewModel() { var rootServices = new PhotoServices(); PhotoList = rootServices.GetphotoList(); }