Skip to content

Commit

Permalink
Add EnhanceImages API
Browse files Browse the repository at this point in the history
  • Loading branch information
seantiz committed Dec 24, 2024
1 parent 500c5c5 commit b7b7169
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It's still in alpha because I've yet to implement ability to apply transformatio

## Quick Start

Installation options:
Quick start options:

1. Install globally:
```bash
Expand All @@ -21,6 +21,22 @@ Installation options:

2. Via Makefile: Create a Makefile to run `enhanceddimg-go` programatically before your build command.

3. Import as a dependency (NOTE: Run BEFORE any http handlers!):

```go
// Your web app's main module
import "github.com/seantiz/enhancedimg-go/enhancedimg"

// IMPORTANT: Make a call to the EnhanceImages API before any http template handlers
// Change path argument passed to EnhanceImages as needed
func main() {
err := enhancedimg.EnhanceImages("./")
if err != nil {
log.Fatal(err)
}
}
```

## Features

- Responsive web design supported but no data transforms handled yet.
Expand Down
14 changes: 14 additions & 0 deletions enhancedimg/api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package enhancedimg

import (
"os"
)

// EnhanceImages acts as the public API to use this package as a dependency
// path argument should be the path holding all html templates you want to be processed
func EnhanceImages(path string) error {
if err := os.MkdirAll("static/processed", 0755); err != nil {
return err
}
return FindAllImageElements(path)
}

0 comments on commit b7b7169

Please sign in to comment.