나는 데이터베이스에 이미지를 업로드합니다. 데이터베이스에 저장하기 전에 크기를 줄이고 높이와 너비를 줄이는 것과 같은 이미지 관리를하고 싶습니다. 나를 도와 주실 수있으세요. 거기에 어떤 소스 코드 또는 참조하시기 바랍니다.이미지 관리? 내 응용 프로그램에서
1
A
답변
0
어떤 코드 숨김 언어를 사용하고 있습니까? 나는 4guysfromrolla 좋은 ASP.NET 기준으로 찾을 수
은, 우선은이 문서를보십시오
0
당신은 썸네일 이미지를 만드는 같은 것을 얘기하는 경우. Image() 클래스를 사용하면 기존 이미지를 위 또는 아래로 스케일 할 수 있습니다. YMMV.
+0
예 정확히 Mr. No Refunds No Returns –
0
System.Drawing
ASP.NET에서 이미지를 조작하기위한 이름 공간을보고 싶습니다. Image.FromFile()
, Image.FromStream()
등을 사용하여 지원되는 이미지 파일 유형 (예 : jpg, gif, png 등)을로드 할 수 있습니다. 거기에서 그리기 그래픽 컨텍스트를 사용하여 이미지를 조작 할 수 있습니다.
// Creates a re-sized image from the SourceFile provided that retails the same aspect ratio of the SourceImage.
// - If either the width or height dimensions is not provided then the resized image will use the
// proportion of the provided dimension to calculate the missing one.
// - If both the width and height are provided then the resized image will have the dimensions provided
// with the sides of the excess portions clipped from the center of the image.
public static Image ResizeImage(Image sourceImage, int? newWidth, int? newHeight)
{
bool doNotScale = newWidth == null || newHeight == null; ;
if (newWidth == null)
{
newWidth = (int)(sourceImage.Width * ((float)newHeight/sourceImage.Height));
}
else if (newHeight == null)
{
newHeight = (int)(sourceImage.Height * ((float)newWidth)/sourceImage.Width);
}
var targetImage = new Bitmap(newWidth.Value, newHeight.Value);
Rectangle srcRect;
var desRect = new Rectangle(0, 0, newWidth.Value, newHeight.Value);
if (doNotScale)
{
srcRect = new Rectangle(0, 0, sourceImage.Width, sourceImage.Height);
}
else
{
if (sourceImage.Height > sourceImage.Width)
{
// clip the height
int delta = sourceImage.Height - sourceImage.Width;
srcRect = new Rectangle(0, delta/2, sourceImage.Width, sourceImage.Width);
}
else
{
// clip the width
int delta = sourceImage.Width - sourceImage.Height;
srcRect = new Rectangle(delta/2, 0, sourceImage.Height, sourceImage.Height);
}
}
using (var g = Graphics.FromImage(targetImage))
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(sourceImage, desRect, srcRect, GraphicsUnit.Pixel);
}
return targetImage;
}
0
당신은 ASPJPEG로 이미지 클래스 또는 제 3 자 DLL을 사용할 수 있습니다 : 여기 당신에게 맛을 제공하기 위해 나의 크기 조정 이미지 기능입니다. 몇 가지 ASPJPEG 샘플은 here입니다. 나는 많은 이미지 처리를하고 내 호스트는 reliablesite이 서버에서이 dll을 지원합니다.
관련 문제
- 1. 오류 관리 인터페이스 (playframework) 내 응용 프로그램에서
- 2. (아이폰) 내 응용 프로그램에서
- 3. Silverlight 응용 프로그램에서 링크 관리
- 4. 웹 응용 프로그램에서 EntityManagerFactory 관리
- 5. 응용 프로그램에서 여러 WPF보기 관리
- 6. 내 응용 프로그램에서 응용 프로그램에서 구현하는 방법
- 7. SmsManager 내 응용 프로그램에서
- 8. 내 응용 프로그램에서
- 9. 내 레일 응용 프로그램에서
- 10. 내 응용 프로그램에서 단축키
- 11. 내 응용 프로그램에서 C#
- 12. 문제는 내 응용 프로그램에서
- 13. 내 응용 프로그램에서
- 14. 릴리스는 내 응용 프로그램에서
- 15. BitmapFactory.decodeFile(); 내 응용 프로그램에서
- 16. 내 RoR에 응용 프로그램에서
- 17. Linq에 내 응용 프로그램에서
- 18. 내 응용 프로그램에서 안드로이드
- 19. AIR 응용 프로그램에서 이미지 표시
- 20. 혼란 내 응용 프로그램에서 AsyncTask를
- 21. 응용 프로그램에서 psd 형식의 이미지
- 22. winforms 응용 프로그램에서 이미지 업로드
- 23. asp.net 응용 프로그램에서 데이터베이스에 대한 연결 관리
- 24. asp.net에서 desigining 문제? 내 응용 프로그램에서
- 25. Blackberry - 응용 프로그램에서 전화 회의를 관리 하시겠습니까?
- 26. 보기 기반 응용 프로그램에서 행 관리
- 27. AppEngine/Django : 관리 응용 프로그램에서 db.Key를 편집하십시오.
- 28. 응용 프로그램에서 NSXMLParser로드 된 데이터 관리
- 29. 웹 응용 프로그램에서 여러 .NET 언어 관리
- 30. 내 응용 프로그램에서 브라우저 시작
C# 언어를 사용하고 있습니다. –