2011-12-29 6 views
0

コントローラを持っていて、幅と高さを渡して、新しいサムネイルを生成してデータベースに保存しています。ほとんどの時は動作しますが、gifでは "thumbnail.FileContent = img.GetBytes();"というエラーが返されます。 - "パラメータが無効です"。MVC 3 WebImageを使用しているときに「パラメータが無効です」

ここで間違っている可能性がありますか?

FileManager.Models.File file = _fileRepository.GetFile(fileID); 

fileExtension = file.FileExtension; 

thumbnail = new FileManager.Models.Thumbnail(); 

WebImage img = new WebImage(file.FileContent); 
thumbnail.Width = img.Width; 
thumbnail.Height = img.Height; 
img.Resize(width, height.Value, true); 
img.FileName = file.FileName; 
thumbnail.FileContent = img.GetBytes(); 
thumbnail.FileSize = img.GetBytes().LongLength; 
thumbnail.FileID = fileID; 

_fileRepository.SaveThumbnail(thumbnail); 

img.Write(fileExtension); 

/ラッセ

答えて

0

問題は、それが1未満だったので、比率のいずれかがNULLとして計算してしまったということでした。

+0

その割合はどのくらいですか? –

関連する問題