I’m having a controller, that you pass width and height to, and it generates a new thumbnail and saves it to database. It works most of the times but on gif’s it returns error on “thumbnail.FileContent = img.GetBytes();” – “Parameter is not valid”.
What might be wrong here?
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);
/Lasse
Problem was that one of the proportions got calculated as null since it was less than one.