Skip to content

Releases: cshum/imagor

v1.3.4

05 Dec 01:57
Compare
Choose a tag to compare

What's Changed

  • fix(imagor): Serve, ServeBlob should not require signing by @cshum in #269
  • fix(vips): tweak vips config and lock thread for Process by @cshum in #270
  • fix(vips): disable vips_vector_set_enabled by default by @cshum in #271

Full Changelog: v1.3.3...v1.3.4

v1.3.3

30 Nov 05:04
Compare
Choose a tag to compare

What's Changed

  • fix(vips): fix watermark for 2 band images by @cshum in #259
  • fix(imagor): negative dims auto flip for imagorpath.Params by @cshum in #260
  • feat(imagor): retry query unescape on invalid path by @cshum in #263
  • docs: improve overall documentations by @cshum in #265
  • feat(vips): add bands to metadata by @cshum in #267

Full Changelog: v1.3.2...v1.3.3

v1.3.2

21 Nov 07:34
Compare
Choose a tag to compare

Utility Filters

v1.3 introduces utility filters, which do not manipulate images but provide useful utilities to the imagor pipeline:

  • attachment(filename) returns attachment in the Content-Disposition header, and the browser will open a "Save as" dialog with filename. When filename not specified, imagor will get the filename from the image source
  • expire(timestamp) adds expiration time to the content. timestamp is the unix milliseconds timestamp, e.g. if content is valid for 30s then timestamp would be Date.now() + 30*1000 in JavaScript.
  • preview() skips the result storage even if result storage is enabled. Useful for conditional caching

Go Library

v1.3 also makes imagor more convenient to be used as a Go library.

See example below and also examples folder for various ways you can use imagor:

package main

import (
	"context"
	"github.com/cshum/imagor"
	"github.com/cshum/imagor/imagorpath"
	"github.com/cshum/imagor/loader/httploader"
	"github.com/cshum/imagor/vips"
	"io"
	"os"
)

func main() {
	app := imagor.New(
		imagor.WithUnsafe(true),
		imagor.WithLoaders(httploader.New()),
		imagor.WithProcessors(vips.NewProcessor()),
	)
	ctx := context.Background()
	if err := app.Startup(ctx); err != nil {
		panic(err)
	}
	defer app.Shutdown(ctx)
	blob, err := app.Serve(ctx, imagorpath.Params{
		Unsafe: true,
		Image:  "https://raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png",
		Width:  500,
		Height: 500,
		Smart:  true,
		Filters: []imagorpath.Filter{
			{"fill", "white"},
			{"format", "jpg"},
		},
	})
	if err != nil {
		panic(err)
	}
	reader, _, err := blob.NewReader()
	if err != nil {
		panic(err)
	}
	defer reader.Close()
	file, err := os.Create("gopher.jpg")
	if err != nil {
		panic(err)
	}
	defer file.Close()
	if _, err := io.Copy(file, reader); err != nil {
		panic(err)
	}
}

What's Changed

  • fix accidental copy paste network blocking flag descriptions by @thomasf in #242
  • feat(imagor): expire(timstamp) filter by @cshum in #245
  • fix(vips): apply focal filter for default resizing by @cshum in #249
  • fix(imagor): fix blob.ReadAll() buf size on error by @cshum in #250
  • feat(vips): focal point filter focal(x,y) by @cshum in #251
  • feat(imagor): imagor.Serve method by @cshum in #253
  • feat(imagor): imagor.ServeBlob by @cshum in #254
  • fix(imagor): imagor.Serve ensure path generated by @cshum in #255

Full Changelog: v1.2.4...v1.3.2

v1.2.4

14 Nov 04:55
Compare
Choose a tag to compare

What's Changed

  • refactor(imagor): Blob hybrid ReadSeeker with fanoutreader by @cshum in #238
  • forbid redirects to non allowed URLs by @thomasf in #240
  • add network blocking support in HTTP loader by @thomasf in #241

New Contributors

Full Changelog: v1.2.3...v1.2.4

v1.2.3

05 Nov 09:45
Compare
Choose a tag to compare

What's Changed

  • fix(imagor): json content type detection by @cshum in #222
  • build(deps): golang.org/x/text v0.4.0 by @cshum in #227
  • build(deps): bump github.com/aws/aws-sdk-go from 1.44.114 to 1.44.126 by @dependabot in #228
  • build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.1 by @dependabot in #225
  • build(deps): libvips 8.13.3 by @cshum in #230
  • feat(awsconfig): different AWS credentials for Loader, Storage, Results Storage by @cshum in #231
  • feat(awsconfig): AWS config shared credentials by @cshum in #234

Full Changelog: v1.2.2...v1.2.3

v1.2.2

17 Oct 15:33
Compare
Choose a tag to compare

What's Changed

  • feat(imagor): return 404 in case the host is not found in the http loader by @jvahldick in #214
  • fix(seekstream): remove unnecessary lock from seekstream by @cshum in #216
  • refactor(imagor): add image path to not found error by @cshum in #218
  • fix(vips): trim with alpha channel handling by @cshum in #219
  • feat(imagor): ETag and Modified headers from result storage by @cshum in #221

New Contributors

Full Changelog: v1.2.0...v1.2.2

v1.2.0

11 Oct 14:28
Compare
Choose a tag to compare

Improved Memory Allocation

imagor v1.2.0 improved average memory usage over 30% compare with v1.1.5. This is done by revamping the streaming mechanisms to be more efficient and less memory allocations and copy operations. By doing so imagor introduced 2 reusable Go packages seekstream and fanoutreader that incorporated into imagor.Blob mechanisms:

seekstream

seekstream allows seeking on non-seekable io.ReadCloser source by buffering read data using memory or temp file.

https://pkg.go.dev/github.com/cshum/imagor/seekstream

import  "github.com/cshum/imagor/seekstream"
... 
var source io.ReadCloser // non-seekable
var buffer seekstream.Buffer // memory or temp file buffer
... 
var rs io.ReadSeekCloser = seekstream.New(source, buffer) // seekable

fanoutreader

fanoutreader allows fanout arbitrary number of reader streams concurrently from one data source with known total size, using channel and memory buffer.

https://github.com/cshum/imagor/tree/master/fanoutreader

import  "github.com/cshum/imagor/fanoutreader"
... 
// http source with known size via Content-Length header
resp, _ := http.DefaultClient.Get("https://raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png")
size, _ := strconv.Atoi(resp.Header.Get("Content-Length"))
fanout := fanoutreader.New(resp.Body, size) // create fanout from single reader source

var wg sync.WaitGroup
for i := 0; i < 10; i++ {
	wg.Add(1)
	go func(i int) {
		reader := fanout.NewReader() // spawn new reader
		defer reader.Close()
		file, _ := os.Create(fmt.Sprintf("gopher-%d.png", i))
		defer file.Close()
		_, _ = io.Copy(file, reader) // read concurrently alongside other readers
		wg.Done()
	}(i)
}
wg.Wait()

What's Changed

  • feat(imagor): blob.NewReadSeeker for unknown size or over 100mb by @cshum in #208
  • feat(seekstream): unified seek stream package for memory or temp file buffer by @cshum in #210
  • build(deps): bump github.com/aws/aws-sdk-go from 1.44.106 to 1.44.114 by @dependabot in #207
  • feat(fanout): unified fanout concurrent reader by @cshum in #211
  • feat: seekstream and fanoutreader by @cshum in #212

Full Changelog: v1.1.9...v1.2.0

v1.1.9

08 Oct 04:32
Compare
Choose a tag to compare

What's Changed

  • fix(vips): fix image format parsing and detection by @cshum in #203
  • feat(vips): filter orient(angle) by @cshum in #204
  • fix(vips): remove exif retain vips metadata by @cshum in #205
  • refactor(imagor): fanout seeker improvement by @cshum in #206

Full Changelog: v1.1.6...v1.1.9

v1.1.6

07 Oct 10:12
Compare
Choose a tag to compare

What's Changed

  • build: go 1.19.2 by @cshum in #193
  • fix(vips): check resolution after reload max frames by @cshum in #194
  • feat(vips): filter max_frames(n) by @cshum in #195
  • fix(imagor): fix unexpected EOF by @cshum in #198
  • fix(imagor): fanout buffered read by @cshum in #199
  • refactor(imagor): optimize fanout buffer allocation by @cshum in #201

Full Changelog: v1.1.5...v1.1.6

v1.1.5

01 Oct 13:51
Compare
Choose a tag to compare

What's Changed

  • build(deps): libvips 8.13.2 by @cshum in #190
  • fix(imagorpath): escape image containing reserved keywords by @cshum in #191
  • fix(vips): check resolution by total height by @cshum in #192

Full Changelog: v1.1.4...v1.1.5