TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
271
36.2k
compress image & save to database in asp.net
Aug 18 2020 1:08 PM
hello..
i want to compress an image and save to database...i also try imageprocessor nuget package but its beyond my limits....
protected
void
btnSave_Click(
object
sender, EventArgs e)
{
Model.WallpaperCategory newusermodel =
new
Model.WallpaperCategory();
string
str = fileUpload1.FileName;
fileUpload1.PostedFile.SaveAs(Server.MapPath(
"~/Upload/"
+ str));
string
Path =
"~/Upload/"
+ str.ToString();
foreach
(
string
strfileName
in
Directory.GetFiles(Server.MapPath(
"~/Upload/"
)))
{
ImageButton imagebutton =
new
ImageButton();
FileInfo fileinfo =
new
FileInfo(strfileName);
imagebutton.ImageUrl =
"~/Upload/"
+ fileinfo.Name;
imagebutton.Width = Unit.Pixel(100);
imagebutton.Height = Unit.Pixel(100);
imagebutton.Style.Add(
"padding"
,
"5px"
);
form1.Controls.Add(imagebutton);
imagebutton.Click -=
new
ImageClickEventHandler(imagebutton_Click);
newusermodel.Path = Path;
newusermodel.Category = ddlWallCategry.SelectedItem.Value;
newusermodel.Thumbnail = Path;
newusermodel.CategoryName = ddlWallCategry.SelectedItem.Text;
}
in my code firstly i select image from fileupload then after i show thumbnail images on save button click...My senerio is when its save to database(thumbnail column) its size compress
Reply
Answers (
3
)
Get Subcategory in List.
Read XML nested