Baybars Bay

Baybars Bay

  • 1.7k
  • 88
  • 3.7k

I cannot filter and edit the image I selected in asp.net and save sql

Nov 17 2020 12:32 PM
After selecting the official location, I want to filter and edit the image and then save sql.
**My Model and Controller codes below**
**my codes**
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "PhotoId,Decription,ThumbPath,ImagePath")] Photo photo, HttpPostedFileBase ImagePath)
{
if (ModelState.IsValid)
{
if (ImagePath.ContentLength > 0)
{
var image = Path.GetFileName(ImagePath.FileName);
var path = Path.Combine(Server.MapPath("~/Images"), image);
ImagePath.SaveAs(path);
photo.ImagePath = "/Images/" + image;
db.Photo.Add(photo);
db.SaveChanges();
return RedirectToAction("Index");
}
return HttpNotFound();
}
return HttpNotFound();
}
public partial class Photo
{
public int PhotoId { get; set; }
public string Decription { get; set; }
public string ThumbPath { get; set; }
public string ImagePath { get; set; }
}
[Images](https://hizliresim.com/BlYSSR)
**I want to save sql image like this**
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://bootswatch.com/4/flatly/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<title>Online Image Filter</title>
</head>
<body>
<nav class="navbar navbar-dark bg-info mb-5">
<div class="container">
<a href="#" class="navbar-brand">Online Image Filter</a>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-10 m-auto">
<div class="custum-file mb-3">
<input id="upload-file" type="file" class="upload-file">
<label for="upload-file" class="custom-file-label">Choose Image</label>
<canvas id="canvas" class="my-3"></canvas>
<h4 class="text-center my-3">Filters</h4>
<div class="row text-center my-4">
<div class="col-md-3">
<div class="btn-group btn-group-sm">
<button class="filter-btn brightness-remove btn btn-info">-</button>
<button class="btn btn-secondary btn-disabled" disabled>Brightness</button>
<button class="filter-btn brightness-add btn btn-info">+</button>
</div>
</div>
<div class="col-md-3">
<div class="btn-group btn-group-sm">
<button class="filter-btn contrast-remove btn btn-info">-</button>
<button class="btn btn-secondary btn-disabled" disabled>Contrast</button>
<button class="filter-btn contrast-add btn btn-info">+</button>
</div>
</div>
<div class="col-md-3">
<div class="btn-group btn-group-sm">
<button class="filter-btn saturation-remove btn btn-info">-</button>
<button class="btn btn-secondary btn-disabled" disabled>Saturation</button>
<button class="filter-btn saturation-add btn btn-info">+</button>
</div>
</div>
<div class="col-md-3">
<div class="btn-group btn-group-sm">
<button class="filter-btn vibrance-remove btn btn-info">-</button>
<button class="btn btn-secondary btn-disabled" disabled>Vibrance</button>
<button class="filter-btn vibrance-add btn btn-info">+</button>
</div>
</div>
</div><!-- ROW -->
<div class="row mb-3">
<div class="col-md-3">
<button class="filter-btn vintage-add btn btn-dark btn-block">Vintage</button>
</div>
<div class="col-md-3">
<button class="filter-btn lomo-add btn btn-dark btn-block">Lomo</button>
</div>
<div class="col-md-3">
<button class="filter-btn clarity-add btn btn-dark btn-block">Clarity</button>
</div>
<div class="col-md-3">
<button class="filter-btn sincity-add btn btn-dark btn-block">Sin City</button>
</div>
</div><!--row-->
<div class="row mb-3">
<div class="col-md-3">
<button class="filter-btn vintage-add btn btn-dark btn-block">Cross</button>
</div>
<div class="col-md-3">
<button class="filter-btn pinhole-add btn btn-dark btn-block">Pinhole</button>
</div>
<div class="col-md-3">
<button class="filter-btn nostalgia-add btn btn-dark btn-block">Nostalgia</button>
</div>
<div class="col-md-3">
<button class="filter-btn hermajesty-add btn btn-dark btn-block">Her Majesty</button>
</div><!--row-->
</div><!--row-->
<div class="row my-5">
<div class="col-md-6">
<button id="download-Btn" class="btn btn-primary btn-block">Save Image</button>
</div>
<div class="col-md-6">
<button id="revert-btn" class="btn btn-danger btn-block">Remove Filters</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/camanjs/4.1.2/caman.full.min.js"></script>
<script src="main.js" charset="utf-8"></script>
</body>
</html>
 
 
[images link] https://hizliresim.com/BlYSSR

Answers (2)