Example #1
0
        /// <summary>
        /// Returns the image format and content type for an image extension
        /// </summary>
        /// <param name="extension"></param>
        /// <returns></returns>
        public System.Tuple <ImageFormat, string> GetImageInfo(string extension)
        {
            if (extension.StartsWith("."))
            {
                extension = extension.Trim('.');
            }

            return(Tuple.Create <ImageFormat, string>(GetImageFormat(extension), MimeExtensions.GetMimeType(extension)));
        }
        public void Create(EntityType entityType, int entityId, string fileName, string mimeType = null, FileFlags?flags = null)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException(nameof(fileName));
            }

            if (mimeType == null)
            {
                mimeType = MimeExtensions.GetMimeType(Path.GetExtension(fileName));
            }

            _fileDataProvider.Create(entityType, entityId, fileName, mimeType, flags);
        }