package resource
import "github.com/gohugoio/hugo/resource"
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
- func (r Resources) ByType(tp string) Resources
- func (r Resources) GetByPrefix(prefix string) Resource
- type Source
- type Spec
- func NewSpec(s *helpers.PathSpec, mimeTypes media.Types) (*Spec, error)
- 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, file source.File, relTargetFilename string) (Resource, error)
- func (r *Spec) NewResourceFromFilename( targetPathBuilder func(base string) string, absPublishDir, absSourceFilename, relTargetFilename string) (Resource, error)
Constants ¶
const DefaultResourceType = "unknown"
Types ¶
type Cloner ¶
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) Height ¶
func (Image) Permalink ¶
func (l Image) Permalink() string
func (Image) Publish ¶
func (l Image) Publish() error
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) Width ¶
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 Resource ¶
Resource represents a linkable resource, i.e. a content page, image etc.
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) ByType ¶
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 Source ¶
type Spec ¶
type Spec struct { *helpers.PathSpec AbsGenImagePath string // contains filtered or unexported fields }
func NewSpec ¶
func (*Spec) CacheStats ¶
func (*Spec) DeleteCacheByPrefix ¶
func (*Spec) IsInCache ¶
func (*Spec) NewResourceFromFile ¶
func (r *Spec) NewResourceFromFile( targetPathBuilder func(base string) string, absPublishDir string, file source.File, relTargetFilename string) (Resource, error)
func (*Spec) NewResourceFromFilename ¶
func (r *Spec) NewResourceFromFilename( targetPathBuilder func(base string) string, absPublishDir, absSourceFilename, relTargetFilename string) (Resource, error)
Source Files ¶
image.go image_cache.go resource.go
- Version
- v0.32.4
- Published
- Jan 11, 2018
- Platform
- windows/amd64
- Imports
- 23 packages
- Last checked
- 2 minutes ago –
Tools for package owners.