Permalink
Browse files

Allow all x64_64 to use pre-built images, not just recent processors.…

… Make golint slightly happier. Refactor webp vs preview format selection.
  • Loading branch information...
aaron42net committed Apr 8, 2016
1 parent ffa59d8 commit 8e158df760ca54767d58aa0eee1cd284daa4806f
View
@@ -25,7 +25,7 @@ RUN \
apt-get -q update && \
apt-get -y -q dist-upgrade && \
# Apt-get our dependencies, download, build, and install VIPS, and download and install Go.
DEBIAN_FRONTEND=noninteractive CFLAGS="-O2 -ftree-vectorize -msse4.2 -ffast-math" VIPS_OPTIONS="--disable-gtk-doc-html --disable-pyvips8 --without-cfitsio --without-fftw --without-gsf --without-matio --without-openslide --without-orc --without-pangoft2 --without-python --without-x --without-zip" \
DEBIAN_FRONTEND=noninteractive CFLAGS="-O2 -ftree-vectorize -msse2 -ffast-math" VIPS_OPTIONS="--disable-gtk-doc-html --disable-pyvips8 --without-cfitsio --without-fftw --without-gsf --without-matio --without-openslide --without-orc --without-pangoft2 --without-python --without-x --without-zip" \
/app/src/github.com/die-net/fotomat/preinstall.sh && \
# Create a few directories
View
@@ -10,7 +10,7 @@ ADD preinstall.sh /app/src/github.com/die-net/fotomat/
RUN \
# Apt-get our dependencies, download, build, and install VIPS, and download and install Go.
DEBIAN_FRONTEND=noninteractive CFLAGS="-O2 -ftree-vectorize -msse4.2 -ffast-math -fPIC" VIPS_OPTIONS="--disable-shared --enable-static" \
DEBIAN_FRONTEND=noninteractive CFLAGS="-O2 -ftree-vectorize -msse2 -ffast-math -fPIC" VIPS_OPTIONS="--disable-shared --enable-static" \
/app/src/github.com/die-net/fotomat/preinstall.sh && \
# Add dpkg build tool.
DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends fakeroot && \
View
@@ -10,7 +10,7 @@ ADD preinstall.sh /app/src/github.com/die-net/fotomat/
RUN \
# Apt-get our dependencies, download, build, and install VIPS, and download and install Go.
DEBIAN_FRONTEND=noninteractive CFLAGS="-O2 -ftree-vectorize -msse4.2 -ffast-math -fPIC" VIPS_OPTIONS="--disable-shared --enable-static" \
DEBIAN_FRONTEND=noninteractive CFLAGS="-O2 -ftree-vectorize -msse2 -ffast-math -fPIC" VIPS_OPTIONS="--disable-shared --enable-static" \
/app/src/github.com/die-net/fotomat/preinstall.sh && \
# Add dpkg build tool.
DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends fakeroot && \
View
@@ -10,7 +10,7 @@ ADD preinstall.sh /app/src/github.com/die-net/fotomat/
RUN \
# Install our dependencies. Download, build, and install VIPS. Download and install Go.
CFLAGS="-O2 -ftree-vectorize -msse4.2 -ffast-math -fPIC" LDFLAGS="-lstdc++" VIPS_OPTIONS="--disable-shared --enable-static" \
CFLAGS="-O2 -ftree-vectorize -msse2 -ffast-math -fPIC" LDFLAGS="-lstdc++" VIPS_OPTIONS="--disable-shared --enable-static" \
/app/src/github.com/die-net/fotomat/preinstall.sh && \
# Add a tool for building RPMs.
yum -y install rpm-build
View
@@ -10,7 +10,7 @@ ADD preinstall.sh /app/src/github.com/die-net/fotomat/
RUN \
# Install our dependencies. Download, build, and install VIPS. Download and install Go.
CFLAGS="-O2 -ftree-vectorize -msse4.2 -ffast-math -fPIC" LDFLAGS="-lstdc++" VIPS_OPTIONS="--disable-shared --enable-static" \
CFLAGS="-O2 -ftree-vectorize -msse2 -ffast-math -fPIC" LDFLAGS="-lstdc++" VIPS_OPTIONS="--disable-shared --enable-static" \
/app/src/github.com/die-net/fotomat/preinstall.sh && \
# Add a tool for building RPMs.
yum -y install rpm-build
View
@@ -10,7 +10,7 @@ import (
// Attempt to guess the number of physical (non-hyperthread) cores
// available. If that doesn't work, return Go's count of virtual cores that
// we can be scheduled on.
func numCpuCores() int {
func numCPUCores() int {
cpus := runtime.NumCPU()
cores := procCpuinfoCores()
View
@@ -18,9 +18,9 @@ var (
lossyIfPhoto = flag.Bool("lossy_if_photo", true, "Save as lossy if image is detected as a photo.")
losslessWebp = flag.Bool("lossless_webp", false, "When saving in WebP, allow lossless encoding.")
maxBufferPixels = flag.Int("max_buffer_pixels", 6500000, "Maximum number of pixels to allocate for an intermediate image buffer.")
maxImageThreads = flag.Int("max_image_threads", numCpuCores(), "Maximum number of threads simultaneously processing images (0=all CPUs).")
maxImageThreads = flag.Int("max_image_threads", numCPUCores(), "Maximum number of threads simultaneously processing images (0=all CPUs).")
maxOutputDimension = flag.Int("max_output_dimension", 2048, "Maximum width or height of an image response.")
maxPrefetch = flag.Int("max_prefetch", numCpuCores(), "Maximum number of images to prefetch before thread is available.")
maxPrefetch = flag.Int("max_prefetch", numCPUCores(), "Maximum number of images to prefetch before thread is available.")
maxProcessingDuration = flag.Duration("max_processing_duration", time.Minute, "Maximum duration we can be processing an image before assuming we crashed (0=disable).")
sharpen = flag.Bool("sharpen", false, "Sharpen after resize.")
@@ -83,22 +83,19 @@ func director(req *http.Request) (thumbnail.Options, int) {
},
}
// Preview images are tiny, blurry JPEGs.
if webp {
o.Save.AllowWebp = true
o.Save.Lossless = *losslessWebp
}
// Preview images are tiny, blurry JPEGs/lossy WebPs.
if preview {
o.Sharpen = false
o.BlurSigma = 0.4
o.Save.Format = format.Jpeg
o.Save.Lossless = false
o.Save.Quality = 40
}
if webp {
o.Save.AllowWebp = true
if o.Save.Format != format.Unknown {
o.Save.Format = format.Webp
}
o.Save.Lossless = *losslessWebp
}
return o, 0
}
View
@@ -7,8 +7,8 @@ import (
)
const (
// Updated by git-hooks/pre-commit
FotomatVersion = "2.4.172"
// FotomatVersion is updated by git-hooks/pre-commit
FotomatVersion = "2.4.173"
)
var (
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -97,7 +97,7 @@ func (o Options) ToJSON() ([]byte, error) {
return buf.Bytes(), nil
}
// FromJSON returns Options from a JSON representation of it.
// OptionsFromJSON returns Options from a JSON representation of it.
func OptionsFromJSON(j []byte) (Options, error) {
o := Options{}
if err := json.Unmarshal(j, &o); err != nil {

0 comments on commit 8e158df

Please sign in to comment.