• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class ImageUtils

Inheritance
System.Object
ImageUtils
Namespace: DotNetNuke.Common.Utilities
Assembly: DotNetNuke.dll
Syntax
public class ImageUtils : object

Methods

| Improve this Doc View Source

CreateImage(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
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 or null.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS