public string UploadImageAndGetURL(NoteImageDTO image) { //TODO 7: Get a Cloudinary Account. Create the object like below. Account account = new Account( "appname", "publickey", //You'll need to get these and hide them.... "secretkey" ); //TODO 8: Follow the code below. Set a breakpoint and study each thing var uploadParams = new ImageUploadParams() { File = new FileDescription(image.Image.FileName, image.Image.OpenReadStream()) }; var cloudinary = new Cloudinary(account); var uploadResult = cloudinary.Upload(uploadParams); //Hover over each one of these and ask questions. You should see //an image in Cloudinary after you run this line. var id = uploadResult.JsonObj; var data = JsonConvert.DeserializeObject <RawUploadResult>(id.ToString()); //Discussion question with partner: What is all this? var result = data.SecureUri.ToString(); return(result); }
public Task <bool> UploadeNoteImage(NoteImageDTO image) { //TODO 6: Call the ImageEngine that uploads to Cloudinary. Return a string to store. //You will only store this string. var returnedURL = _engine.UploadImageAndGetURL(image); //TODO 9: Call the repository. Fix the NoteEntity so that it can store the URL property. throw new NotImplementedException(); }