Class ImageUtils
Inheritance
Namespace: DotNetNuke.Common.Utilities
Assembly: DotNetNuke.dll
Syntax
public class ImageUtils : object
Methods
| Improve this Doc View SourceCreateImage(Stream, Int32, Int32, String)
Declaration
public static Stream CreateImage(Stream stream, int intHeight, int intWidth, string extension)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | |
System.Int32 | intHeight | |
System.Int32 | intWidth | |
System.String | extension |
Returns
Type | Description |
---|---|
Stream |
CreateImage(String, Int32, Int32)
create an image.
Declaration
public static string CreateImage(string sFile, int intHeight, int intWidth)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFile | path of image file. |
System.Int32 | intHeight | height. |
System.Int32 | intWidth | width. |
Returns
Type | Description |
---|---|
System.String | The path of the created image. |
CreateImage(String)
create an image.
Declaration
public static string CreateImage(string sFile)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFile | path of load image file - will be resized according to height and width set. |
Returns
Type | Description |
---|---|
System.String | The path of the created image. |
CreateImageForDB(Stream, Int32, Int32)
create an image based on a stream (read from a database).
Declaration
public static MemoryStream CreateImageForDB(Stream sFile, int intHeight, int intWidth)
Parameters
Type | Name | Description |
---|---|---|
Stream | sFile | image name. |
System.Int32 | intHeight | height. |
System.Int32 | intWidth | width. |
Returns
Type | Description |
---|---|
MemoryStream | steam. |
CreateJPG(String, Bitmap, Int32)
create a JPG image.
Declaration
public static string CreateJPG(string sFile, Bitmap img, int compressionLevel)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFile | name of image. |
Bitmap | img | bitmap of image. |
System.Int32 | compressionLevel | image quality. |
Returns
Type | Description |
---|---|
System.String | The path of the created image. |
GetEncoderInfo(String)
return the appropriate encoded for the mime-type of the image being created.
Declaration
public static ImageCodecInfo GetEncoderInfo(string myMimeType)
Parameters
Type | Name | Description |
---|---|---|
System.String | myMimeType | mime type (e.g jpg/png). |
Returns
Type | Description |
---|---|
ImageCodecInfo | The |
GetHeight(String)
return height of image.
Declaration
public static int GetHeight(string sPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | sPath | file path of image. |
Returns
Type | Description |
---|---|
System.Int32 | The image height in pixels. |
GetHeightFromStream(Stream)
return height of image.
Declaration
public static int GetHeightFromStream(Stream sFile)
Parameters
Type | Name | Description |
---|---|---|
Stream | sFile | Stream of image. |
Returns
Type | Description |
---|---|
System.Int32 | The image height in pixels. |
GetSize(String)
return height of image.
Declaration
public static Size GetSize(string sPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | sPath | file path of image. |
Returns
Type | Description |
---|---|
Size | The image size in pixels. |
GetWidth(String)
return width of image.
Declaration
public static int GetWidth(string sPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | sPath | file path of image. |
Returns
Type | Description |
---|---|
System.Int32 | The image width in pixels. |
GetWidthFromStream(Stream)
width of image.
Declaration
public static int GetWidthFromStream(Stream sFile)
Parameters
Type | Name | Description |
---|---|---|
Stream | sFile | Steam of image. |
Returns
Type | Description |
---|---|
System.Int32 | The image width in pixels. |
NewImageSize(Int32, Int32, Int32, Int32)
scale an image based on existing dimensions and updated requirement.
Declaration
public static Size NewImageSize(int currentWidth, int currentHeight, int newWidth, int newHeight)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | currentWidth | current width. |
System.Int32 | currentHeight | current height. |
System.Int32 | newWidth | new width. |
System.Int32 | newHeight | new height. |
Returns
Type | Description |
---|---|
Size | updated calculated height/width dimensions. |