C# Класс Nop.Services.Media.PictureService

Picture service
Наследование: IPictureService
Показать файл Открыть проект

Открытые методы

Метод Описание
DeletePicture ( Nop.Core.Domain.Media.Picture picture ) : void

Deletes a picture

GetDefaultPictureUrl ( int targetSize, PictureType defaultPictureType = PictureType.Entity, bool useSsl = null ) : string

Gets the default picture URL

GetPictureById ( int pictureId ) : Nop.Core.Domain.Media.Picture

Gets a picture

GetPictureLocalPath ( Nop.Core.Domain.Media.Picture picture, int targetSize, bool showDefaultPicture = true ) : string

Get a picture local path

GetPictureSeName ( string name ) : string

Get picture SEO friendly name

GetPictureUrl ( Nop.Core.Domain.Media.Picture picture, int targetSize, bool showDefaultPicture = true, bool useSsl = null ) : string

Get a picture URL

GetPictureUrl ( int pictureId, int targetSize, bool showDefaultPicture = true, bool useSsl = null ) : string

Get a picture URL

GetPictures ( int pageIndex, int pageSize ) : IPagedList

Gets a collection of pictures

GetPicturesByProductId ( int productId ) : IList

Gets pictures by product identifier

GetPicturesByProductId ( int productId, int recordsToReturn ) : IList

Gets pictures by product identifier

InsertPicture ( byte pictureBinary, string mimeType, string seoFilename, bool isNew ) : Nop.Core.Domain.Media.Picture

Inserts a picture

LoadPictureBinary ( Nop.Core.Domain.Media.Picture picture ) : byte[]

Gets the loaded picture binary depending on picture storage settings

LoadPictureBinary ( Nop.Core.Domain.Media.Picture picture, bool fromDb ) : byte[]

Gets the loaded picture binary depending on picture storage settings

LoadPictureFromFile ( int pictureId, string mimeType ) : byte[]

Loads a cpiture from file

PictureService ( IRepository pictureRepository, IRepository productPictureRepository, ISettingService settingService, IWebHelper webHelper, IEventPublisher eventPublisher, Nop.Core.Domain.Media.MediaSettings mediaSettings ) : System

Ctor

SetSeoFilename ( int pictureId, string seoFilename ) : Nop.Core.Domain.Media.Picture

Updates a SEO filename of a picture

UpdatePicture ( int pictureId, byte pictureBinary, string mimeType, string seoFilename, bool isNew ) : Nop.Core.Domain.Media.Picture

Updates the picture

ValidatePicture ( byte pictureBinary, string mimeType ) : byte[]

Validates input picture dimensions

Защищенные методы

Метод Описание
CalculateDimensions ( Size originalSize, int targetSize ) : Size

Calculates picture dimensions whilst maintaining aspect

DeletePictureOnFileSystem ( Nop.Core.Domain.Media.Picture picture ) : void

Delete a picture on file system

DeletePictureThumbs ( Nop.Core.Domain.Media.Picture picture ) : void

Delete picture thumbs

GetFileExtensionFromMimeType ( string mimeType ) : string

Returns the file extension from mime type.

GetImageCodecInfoFromExtension ( string fileExt ) : ImageCodecInfo

Returns the first ImageCodecInfo instance with the specified extension.

GetImageCodecInfoFromMimeType ( string mimeType ) : ImageCodecInfo

Returns the first ImageCodecInfo instance with the specified mime type.

SavePictureInFile ( int pictureId, byte pictureBinary, string mimeType ) : void

Save picture on file system

Описание методов

CalculateDimensions() защищенный Метод

Calculates picture dimensions whilst maintaining aspect
protected CalculateDimensions ( Size originalSize, int targetSize ) : Size
originalSize System.Drawing.Size The original picture size
targetSize int The target picture size (longest side)
Результат System.Drawing.Size

DeletePicture() публичный Метод

Deletes a picture
public DeletePicture ( Nop.Core.Domain.Media.Picture picture ) : void
picture Nop.Core.Domain.Media.Picture Picture
Результат void

DeletePictureOnFileSystem() защищенный Метод

Delete a picture on file system
protected DeletePictureOnFileSystem ( Nop.Core.Domain.Media.Picture picture ) : void
picture Nop.Core.Domain.Media.Picture Picture
Результат void

DeletePictureThumbs() защищенный Метод

Delete picture thumbs
protected DeletePictureThumbs ( Nop.Core.Domain.Media.Picture picture ) : void
picture Nop.Core.Domain.Media.Picture Picture
Результат void

GetDefaultPictureUrl() публичный Метод

Gets the default picture URL
public GetDefaultPictureUrl ( int targetSize, PictureType defaultPictureType = PictureType.Entity, bool useSsl = null ) : string
targetSize int The target picture size (longest side)
defaultPictureType PictureType Default picture type
useSsl bool Value indicating whether to get SSL protected picture URL; null to use the same value as the current page
Результат string

GetFileExtensionFromMimeType() защищенный Метод

Returns the file extension from mime type.
protected GetFileExtensionFromMimeType ( string mimeType ) : string
mimeType string Mime type
Результат string

GetImageCodecInfoFromExtension() защищенный Метод

Returns the first ImageCodecInfo instance with the specified extension.
protected GetImageCodecInfoFromExtension ( string fileExt ) : ImageCodecInfo
fileExt string File extension
Результат ImageCodecInfo

GetImageCodecInfoFromMimeType() защищенный Метод

Returns the first ImageCodecInfo instance with the specified mime type.
protected GetImageCodecInfoFromMimeType ( string mimeType ) : ImageCodecInfo
mimeType string Mime type
Результат ImageCodecInfo

GetPictureById() публичный Метод

Gets a picture
public GetPictureById ( int pictureId ) : Nop.Core.Domain.Media.Picture
pictureId int Picture identifier
Результат Nop.Core.Domain.Media.Picture

GetPictureLocalPath() публичный Метод

Get a picture local path
public GetPictureLocalPath ( Nop.Core.Domain.Media.Picture picture, int targetSize, bool showDefaultPicture = true ) : string
picture Nop.Core.Domain.Media.Picture Picture instance
targetSize int The target picture size (longest side)
showDefaultPicture bool A value indicating whether the default picture is shown
Результат string

GetPictureSeName() публичный Метод

Get picture SEO friendly name
public GetPictureSeName ( string name ) : string
name string Name
Результат string

GetPictureUrl() публичный Метод

Get a picture URL
public GetPictureUrl ( Nop.Core.Domain.Media.Picture picture, int targetSize, bool showDefaultPicture = true, bool useSsl = null ) : string
picture Nop.Core.Domain.Media.Picture Picture instance
targetSize int The target picture size (longest side)
showDefaultPicture bool A value indicating whether the default picture is shown
useSsl bool Value indicating whether to get SSL protected picture URL; null to use the same value as the current page
Результат string

GetPictureUrl() публичный Метод

Get a picture URL
public GetPictureUrl ( int pictureId, int targetSize, bool showDefaultPicture = true, bool useSsl = null ) : string
pictureId int Picture identifier
targetSize int The target picture size (longest side)
showDefaultPicture bool A value indicating whether the default picture is shown
useSsl bool Value indicating whether to get SSL protected picture URL; null to use the same value as the current page
Результат string

GetPictures() публичный Метод

Gets a collection of pictures
public GetPictures ( int pageIndex, int pageSize ) : IPagedList
pageIndex int Current page
pageSize int Items on each page
Результат IPagedList

GetPicturesByProductId() публичный Метод

Gets pictures by product identifier
public GetPicturesByProductId ( int productId ) : IList
productId int Product identifier
Результат IList

GetPicturesByProductId() публичный Метод

Gets pictures by product identifier
public GetPicturesByProductId ( int productId, int recordsToReturn ) : IList
productId int Product identifier
recordsToReturn int Number of records to return. 0 if you want to get all items
Результат IList

InsertPicture() публичный Метод

Inserts a picture
public InsertPicture ( byte pictureBinary, string mimeType, string seoFilename, bool isNew ) : Nop.Core.Domain.Media.Picture
pictureBinary byte The picture binary
mimeType string The picture MIME type
seoFilename string The SEO filename
isNew bool A value indicating whether the picture is new
Результат Nop.Core.Domain.Media.Picture

LoadPictureBinary() публичный Метод

Gets the loaded picture binary depending on picture storage settings
public LoadPictureBinary ( Nop.Core.Domain.Media.Picture picture ) : byte[]
picture Nop.Core.Domain.Media.Picture Picture
Результат byte[]

LoadPictureBinary() публичный Метод

Gets the loaded picture binary depending on picture storage settings
public LoadPictureBinary ( Nop.Core.Domain.Media.Picture picture, bool fromDb ) : byte[]
picture Nop.Core.Domain.Media.Picture Picture
fromDb bool Load from database; otherwise, from file system
Результат byte[]

LoadPictureFromFile() публичный Метод

Loads a cpiture from file
public LoadPictureFromFile ( int pictureId, string mimeType ) : byte[]
pictureId int Picture identifier
mimeType string MIME type
Результат byte[]

PictureService() публичный Метод

Ctor
public PictureService ( IRepository pictureRepository, IRepository productPictureRepository, ISettingService settingService, IWebHelper webHelper, IEventPublisher eventPublisher, Nop.Core.Domain.Media.MediaSettings mediaSettings ) : System
pictureRepository IRepository Picture repository
productPictureRepository IRepository Product picture repository
settingService ISettingService Setting service
webHelper IWebHelper Web helper
eventPublisher IEventPublisher Event publisher
mediaSettings Nop.Core.Domain.Media.MediaSettings Media settings
Результат System

SavePictureInFile() защищенный Метод

Save picture on file system
protected SavePictureInFile ( int pictureId, byte pictureBinary, string mimeType ) : void
pictureId int Picture identifier
pictureBinary byte Picture binary
mimeType string MIME type
Результат void

SetSeoFilename() публичный Метод

Updates a SEO filename of a picture
public SetSeoFilename ( int pictureId, string seoFilename ) : Nop.Core.Domain.Media.Picture
pictureId int The picture identifier
seoFilename string The SEO filename
Результат Nop.Core.Domain.Media.Picture

UpdatePicture() публичный Метод

Updates the picture
public UpdatePicture ( int pictureId, byte pictureBinary, string mimeType, string seoFilename, bool isNew ) : Nop.Core.Domain.Media.Picture
pictureId int The picture identifier
pictureBinary byte The picture binary
mimeType string The picture MIME type
seoFilename string The SEO filename
isNew bool A value indicating whether the picture is new
Результат Nop.Core.Domain.Media.Picture

ValidatePicture() публичный Метод

Validates input picture dimensions
public ValidatePicture ( byte pictureBinary, string mimeType ) : byte[]
pictureBinary byte Picture binary
mimeType string MIME type
Результат byte[]