Documentation ¶
Index ¶
- Constants
- type Cloner
- type Image
- func (l Image) AbsSourceFilename() string
- func (i *Image) Fill(spec string) (*Image, error)
- func (i *Image) Fit(spec string) (*Image, error)
- func (i *Image) Height() int
- func (l Image) Permalink() string
- func (l Image) Publish() error
- func (l Image) RelPermalink() string
- func (i *Image) Resize(spec string) (*Image, error)
- func (l Image) ResourceType() string
- func (i *Image) Width() int
- func (i *Image) WithNewBase(base string) Resource
- type Imaging
- type Resource
- type Resources
- type Source
- type Spec
- func (r *Spec) CacheStats() string
- func (r *Spec) DeleteCacheByPrefix(prefix string)
- func (r *Spec) IsInCache(key string) bool
- func (r *Spec) NewResourceFromFile(targetPathBuilder func(base string) string, absPublishDir string, ...) (Resource, error)
- func (r *Spec) NewResourceFromFilename(targetPathBuilder func(base string) string, ...) (Resource, error)
Constants ¶
const DefaultResourceType = "unknown"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
func (Image) AbsSourceFilename ¶
func (l Image) AbsSourceFilename() string
func (*Image) Fill ¶
Fill scales the image to the smallest possible size that will cover the specified dimensions, crops the resized image to the specified dimensions using the given anchor point. Space delimited config: 200x300 TopLeft
func (*Image) Fit ¶
Fit scales down the image using the specified resample filter to fit the specified maximum width and height.
func (Image) RelPermalink ¶
func (l Image) RelPermalink() string
func (*Image) Resize ¶
Resize resizes the image to the specified width and height using the specified resampling filter and returns the transformed image. If one of width or height is 0, the image aspect ratio is preserved.
func (Image) ResourceType ¶
func (l Image) ResourceType() string
func (*Image) WithNewBase ¶
Implement the Cloner interface.
type Imaging ¶
type Imaging struct { // Default image quality setting (1-100). Only used for JPEG images. Quality int // Resample filter used. See https://github.com/disintegration/imaging ResampleFilter string }
Imaging contains default image processing configuration. This will be fetched from site (or language) config.
type Resources ¶
type Resources []Resource
Resources represents a slice of resources, which can be a mix of different types. I.e. both pages and images etc.
func (Resources) GetByPrefix ¶
GetBySuffix gets the first resource matching the given filename prefix, e.g "logo" will match logo.png. It returns nil of none found. In potential ambiguous situations, combine it with ByType.
type Spec ¶
type Spec struct { *helpers.PathSpec AbsGenImagePath string // contains filtered or unexported fields }