FromFile() 공개 정적인 메소드

Creates a thumbnail from the given image file.
public static FromFile ( string filename, Size size, UseEmbeddedThumbnails useEmbeddedThumbnails, bool useExifOrientation, bool useWIC ) : Image
filename string The filename pointing to an image.
size System.Drawing.Size Requested image size.
useEmbeddedThumbnails UseEmbeddedThumbnails Embedded thumbnail usage.
useExifOrientation bool true to automatically rotate images based on Exif orientation; otherwise false.
useWIC bool true to use Windows Imaging Component; otherwise false.
리턴 Image
            /// <summary>
            /// Returns the thumbnail image for the given item.
            /// </summary>
            /// <param name="key">Item key.</param>
            /// <param name="size">Requested image size.</param>
            /// <param name="useEmbeddedThumbnails">Embedded thumbnail usage.</param>
            /// <param name="useExifOrientation">true to automatically rotate images based on Exif orientation; otherwise false.</param>
            /// <param name="useWIC">true to use Windows Imaging Component; otherwise false.</param>
            /// <returns>The thumbnail image from the given item or null if an error occurs.</returns>
            public override Image GetThumbnail(object key, Size size, UseEmbeddedThumbnails useEmbeddedThumbnails, bool useExifOrientation, bool useWIC)
            {
                if (disposed)
                {
                    return(null);
                }

                string filename = (string)key;

                if (File.Exists(filename))
                {
                    return(ThumbnailExtractor.FromFile(filename, size, useEmbeddedThumbnails, useExifOrientation, useWIC));
                }
                else
                {
                    return(null);
                }
            }
            /// <summary>
            /// Returns the thumbnail image for the given item.
            /// </summary>
            /// <param name="key">Item key.</param>
            /// <param name="size">Requested image size.</param>
            /// <param name="useEmbeddedThumbnails">Embedded thumbnail usage.</param>
            /// <param name="useExifOrientation">true to automatically rotate images based on Exif orientation; otherwise false.</param>
            /// <param name="useWIC">true to use Windows Imaging Component; otherwise false.</param>
            /// <returns>The thumbnail image from the given item or null if an error occurs.</returns>
            public override Image GetThumbnail(object key, Size size, UseEmbeddedThumbnails useEmbeddedThumbnails, bool useExifOrientation, bool useWIC)
            {
                if (disposed)
                {
                    return(null);
                }

                // [IG_CHANGE]
                // Issue #530: thumbnails not built if long file path
                string filename = Heart.Helpers.PrefixLongPath((string)key);

                if (File.Exists(filename))
                {
                    return(ThumbnailExtractor.FromFile(filename, size, useEmbeddedThumbnails, useExifOrientation, useWIC));
                }
                else
                {
                    return(null);
                }
            }