Documentation ¶
Overview ¶
Package pageview implements a web page link preview.
Copyright © 2019 M.Watermann, 10247 Berlin, Germany All rights reserved EMail : <support@mwat.de>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You should have received a copy of the GNU General Public License along with this program. If not, see the [GNU General Public License](http://www.gnu.org/licenses/gpl.html) for details.
Index ¶
- func CreateImage(aURL string) (string, error)
- func ImageDirectory() string
- func ImageFileType() string
- func ImageHeight() int
- func ImageQuality() int
- func ImageWidth() int
- func MaxAge() time.Duration
- func PathFile(aURL string) string
- func SetImageDirectory(aDirectory string) error
- func SetImageFileType(aType string)
- func SetImageHeight(aHeight int)
- func SetImageQuality(aQuality int)
- func SetImageWidth(aWidth int)
- func SetMaxAge(aLengthInSeconds time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateImage ¶
CreateImage generates an image of `aURL` and stores it in `ImageDirectory()`, returning the file name of the saved image.
`aURL` The address of the web page to process.
func ImageDirectory ¶ added in v0.2.0
func ImageDirectory() string
ImageDirectory returns the directory used to store the generated images.
func ImageFileType ¶ added in v0.1.2
func ImageFileType() string
ImageFileType returns the type of the image fles to generate.
func ImageHeight ¶ added in v0.1.2
func ImageHeight() int
ImageHeight is the height in pixels of the imaginary screen used to render. The default value is `768`.
The value `0` (zero) renders the entire page top to bottom, calculating the actual height from the page content.
func ImageQuality ¶ added in v0.1.2
func ImageQuality() int
ImageQuality returns the desired image quality.
func ImageWidth ¶ added in v0.1.2
func ImageWidth() int
ImageWidth is the width in pixels of the imaginary screen used to render. The default value is `1024`. Note that this is used only as a guide line.
func PathFile ¶
PathFile returns the complete local path/file of `aURL`.
NOTE: This function does not check whether the file for `aURL` actually exists in the local filesystem.
`aURL` The address of the web page to process.
func SetImageDirectory ¶ added in v0.2.0
SetImageDirectory sets the directory to use for storing the generated images, returning an error if `aDirectory` can't be used.
`aDirectory` The directory to store the generated images.
func SetImageFileType ¶ added in v0.1.2
func SetImageFileType(aType string)
SetImageFileType changes the type of the generated images. The default type is `png`, the other options are `gif`, `jpg` and `svg`. Passing an invalid value in `aType` will result in `png` being selected.
NOTE: Depending on how your `wkhtmltoimage` binary was compiled not all formats might be supported.
`aType` is the new desired type of the images to generate.
func SetImageHeight ¶ added in v0.1.2
func SetImageHeight(aHeight int)
SetImageHeight sets the height of the images to generate. The default value is `768`.
`aHeight` The new height of the images to generate.
func SetImageQuality ¶ added in v0.1.2
func SetImageQuality(aQuality int)
SetImageQuality changes the quality of the genereated image. Values supported between `1` and `100`; default is `100`.
`aQuality` the new desired image quality.
func SetImageWidth ¶ added in v0.1.2
func SetImageWidth(aWidth int)
SetImageWidth sets the width of the images to generate. The default value is `1024`.
`aWidth` The new width of the images to generate.
func SetMaxAge ¶
SetMaxAge sets the maximum age of cached page images before they might get updated.
Usually you want this property at its default value (`0`, zero) which disables an age check because you want an image of the page at the time you linked to it.
`aLengthInSeconds` is the age a page image can have before
requesting it again.
Types ¶
This section is empty.