mirror of
https://github.com/talgo-cloud/talgo-libwebp.git
synced 2026-03-07 21:48:16 -08:00
commit
c356a8c12f
2 changed files with 31 additions and 3 deletions
16
.travis.yml
16
.travis.yml
|
|
@ -4,6 +4,20 @@ go:
|
|||
- 1.3
|
||||
- 1.4
|
||||
|
||||
env:
|
||||
- LIBWEBP_VERSION="0.4.1"
|
||||
- LIBWEBP_VERSION="0.4.2"
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq libwebp
|
||||
- sudo apt-get install -qq libjpeg-dev libpng-dev libtiff-dev libgif-dev
|
||||
- >
|
||||
cd /tmp
|
||||
&& wget http://downloads.webmproject.org/releases/webp/libwebp-${LIBWEBP_VERSION}.tar.gz
|
||||
&& tar xf libwebp-${LIBWEBP_VERSION}.tar.gz
|
||||
&& cd libwebp-${LIBWEBP_VERSION}
|
||||
&& ./configure
|
||||
&& make
|
||||
&& sudo make install
|
||||
- cd $HOME/gopath/src/github.com/harukasan/go-libwebp
|
||||
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
|
||||
|
|
|
|||
|
|
@ -3,22 +3,36 @@ package util
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/png"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GetExFilePath returns the path of specified example file.
|
||||
func GetExFilePath(name string) string {
|
||||
return filepath.Join(os.Getenv("GOPATH"), "src/github.com/harukasan/go-libwebp/examples/images", name)
|
||||
for _, gopath := range strings.Split(os.Getenv("GOPATH"), ":") {
|
||||
path := filepath.Join(gopath, "src/github.com/harukasan/go-libwebp/examples/images", name)
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return path
|
||||
}
|
||||
}
|
||||
panic(fmt.Errorf("%v does not exist in any directory which contains in $GOPATH", name))
|
||||
}
|
||||
|
||||
// GetOutFilePath returns the path of specified out file.
|
||||
func GetOutFilePath(name string) string {
|
||||
return filepath.Join(os.Getenv("GOPATH"), "src/github.com/harukasan/go-libwebp/examples/out", name)
|
||||
for _, gopath := range strings.Split(os.Getenv("GOPATH"), ":") {
|
||||
path := filepath.Join(gopath, "src/github.com/harukasan/go-libwebp/examples/out")
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return filepath.Join(path, name)
|
||||
}
|
||||
}
|
||||
panic(fmt.Errorf("out directory does not exist in any directory which contains in $GOPATH"))
|
||||
}
|
||||
|
||||
// OpenFile opens specified example file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue