C# Class Nop.Services.Media.PictureService

Picture service
Inheritance: IPictureService
Afficher le fichier Open project: jimmy00784/nopCommerce-Linux-Mysql

Méthodes publiques

Méthode Description
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

Méthodes protégées

Méthode Description
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

Method Details

CalculateDimensions() protected méthode

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)
Résultat System.Drawing.Size

DeletePicture() public méthode

Deletes a picture
public DeletePicture ( Nop.Core.Domain.Media.Picture picture ) : void
picture Nop.Core.Domain.Media.Picture Picture
Résultat void

DeletePictureOnFileSystem() protected méthode

Delete a picture on file system
protected DeletePictureOnFileSystem ( Nop.Core.Domain.Media.Picture picture ) : void
picture Nop.Core.Domain.Media.Picture Picture
Résultat void

DeletePictureThumbs() protected méthode

Delete picture thumbs
protected DeletePictureThumbs ( Nop.Core.Domain.Media.Picture picture ) : void
picture Nop.Core.Domain.Media.Picture Picture
Résultat void

GetDefaultPictureUrl() public méthode

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
Résultat string

GetFileExtensionFromMimeType() protected méthode

Returns the file extension from mime type.
protected GetFileExtensionFromMimeType ( string mimeType ) : string
mimeType string Mime type
Résultat string

GetImageCodecInfoFromExtension() protected méthode

Returns the first ImageCodecInfo instance with the specified extension.
protected GetImageCodecInfoFromExtension ( string fileExt ) : ImageCodecInfo
fileExt string File extension
Résultat ImageCodecInfo

GetImageCodecInfoFromMimeType() protected méthode

Returns the first ImageCodecInfo instance with the specified mime type.
protected GetImageCodecInfoFromMimeType ( string mimeType ) : ImageCodecInfo
mimeType string Mime type
Résultat ImageCodecInfo

GetPictureById() public méthode

Gets a picture
public GetPictureById ( int pictureId ) : Nop.Core.Domain.Media.Picture
pictureId int Picture identifier
Résultat Nop.Core.Domain.Media.Picture

GetPictureLocalPath() public méthode

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
Résultat string

GetPictureSeName() public méthode

Get picture SEO friendly name
public GetPictureSeName ( string name ) : string
name string Name
Résultat string

GetPictureUrl() public méthode

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
Résultat string

GetPictureUrl() public méthode

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
Résultat string

GetPictures() public méthode

Gets a collection of pictures
public GetPictures ( int pageIndex, int pageSize ) : IPagedList
pageIndex int Current page
pageSize int Items on each page
Résultat IPagedList

GetPicturesByProductId() public méthode

Gets pictures by product identifier
public GetPicturesByProductId ( int productId ) : IList
productId int Product identifier
Résultat IList

GetPicturesByProductId() public méthode

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
Résultat IList

InsertPicture() public méthode

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
Résultat Nop.Core.Domain.Media.Picture

LoadPictureBinary() public méthode

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
Résultat byte[]

LoadPictureBinary() public méthode

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
Résultat byte[]

LoadPictureFromFile() public méthode

Loads a cpiture from file
public LoadPictureFromFile ( int pictureId, string mimeType ) : byte[]
pictureId int Picture identifier
mimeType string MIME type
Résultat byte[]

PictureService() public méthode

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
Résultat System

SavePictureInFile() protected méthode

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
Résultat void

SetSeoFilename() public méthode

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
Résultat Nop.Core.Domain.Media.Picture

UpdatePicture() public méthode

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
Résultat Nop.Core.Domain.Media.Picture

ValidatePicture() public méthode

Validates input picture dimensions
public ValidatePicture ( byte pictureBinary, string mimeType ) : byte[]
pictureBinary byte Picture binary
mimeType string MIME type
Résultat byte[]