💡 Add some helpful comments in example
This commit is contained in:
parent
4b9bffb1a6
commit
c32a15f4a1
1 changed files with 6 additions and 2 deletions
|
|
@ -17,8 +17,10 @@ func NominoConfig() nomino.Config {
|
|||
)
|
||||
}
|
||||
|
||||
// / HandleImgUploads generates new filenames for images with a png extension.
|
||||
// HandleImgUploads generates new filenames for images with a png extension.
|
||||
func HandleImgUploads(orig string) string {
|
||||
// Here, we use nomino.Make function to generate the filename.
|
||||
// We use our global config, and add in a few extra Options specific to this.
|
||||
newName, _ := nomino.Make(
|
||||
NominoConfig(),
|
||||
nomino.WithExtension("png"),
|
||||
|
|
@ -32,6 +34,8 @@ func HandleImgUploads(orig string) string {
|
|||
// We ignore the original filename and use a timestamp for the generated part
|
||||
// with a webm extension.
|
||||
func HandleVidUploads() string {
|
||||
// Because we're using a different Generator, we chose to use the Make method on the Generator.
|
||||
// We add in additional Options with the `AddOptions` method on the `Config`
|
||||
newName, _ := nomino.Timestamp(nomino.TimestampUTC()).
|
||||
MakeWithConfig(NominoConfig().AddOptions(
|
||||
nomino.WithExtension("webm"),
|
||||
|
|
@ -39,7 +43,7 @@ func HandleVidUploads() string {
|
|||
return newName
|
||||
}
|
||||
|
||||
// Example shows how to use nomino.
|
||||
// This example shows how to use nomino.
|
||||
func Example() {
|
||||
// Pretend we have an image upload
|
||||
filename := "George"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue