컨트롤러를 통해 이미지를 가져와야하는 이유로 인해 ImageController:ViewFile(int id)
.컨트롤러를 통해 이미지 크기 조정
그렇다면 image resizing을 사용할 수 없습니다.
은 내가 시도 : 다음과 같이 그 컨트롤러가
<img src="/File/ViewImage/4?width=100"/><br/>
확인을 위해 :
public class FileController : Controller
{
private readonly IFileService _fileService;
public FileController(IFileService fileService)
{
_fileService = fileService;
}
public ActionResult ViewImage(int id)
{
var image = _fileService.ViewImage(id);
if (image == null)
{
return new HttpNotFoundResult();
}
return File(image.FilePath, image.ContentType, image.FileName);
}
........
그러나 행운. 누구도 같은 문제가 있습니까?
나만 또는 이미지가 표시되지 않습니까? 시도한 것을 일반적인 형식의 텍스트로 넣을 수 있습니까? – Silvermind
안녕하세요. 나는 질문을 업데이트했다. 너 지금 더 잘 대답 해. – DarthVader
'return File'은 단지 스트림만을 반환합니다. 일부 도구를 사용하여 이미지의 크기를 조정하고 크기가 조정 된 이미지의 MemoryStream/FileStream을 반환하거나 문제를 파악하지 못합니까? – Silvermind