imagor

Fast, secure image processing server and Go library, using libvips

APACHE-2.0 License

Stars
3.2K
Committers
22

Bot releases are hidden (Show)

imagor - v1.4.11 Latest Release

Published by cshum 7 months ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.10...v1.4.11

imagor - v1.4.10

Published by cshum 7 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.9...v1.4.10

imagor - v1.4.9

Published by cshum 8 months ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.8...v1.4.9

imagor - v1.4.8

Published by cshum 11 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.7...v1.4.8

imagor - v1.4.7

Published by cshum about 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.6...v1.4.7

imagor - v1.4.6

Published by cshum over 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.5...v1.4.6

imagor - v1.4.5

Published by cshum over 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.4...v1.4.5

imagor - v1.4.4

Published by cshum over 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.3...v1.4.4

imagor - v1.4.3

Published by cshum over 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.2...v1.4.3

imagor - v1.4.2

Published by cshum over 1 year ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.1...v1.4.2

imagor - v1.4.1

Published by cshum over 1 year ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.4.0...v1.4.1

imagor - v1.4.0

Published by cshum over 1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.3.7...v1.4.0

imagor - v1.3.7

Published by cshum almost 2 years ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.3.6...v1.3.7

imagor - v1.3.6

Published by cshum almost 2 years ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.3.5...v1.3.6

imagor - v1.3.5

Published by cshum almost 2 years ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.3.4...v1.3.5

imagor - v1.3.4

Published by cshum almost 2 years ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.3.3...v1.3.4

imagor - v1.3.3

Published by cshum almost 2 years ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.3.2...v1.3.3

imagor - v1.3.2

Published by cshum almost 2 years ago

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

Full Changelog: https://github.com/cshum/imagor/compare/v1.2.4...v1.3.2

imagor - v1.2.4

Published by cshum almost 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/cshum/imagor/compare/v1.2.3...v1.2.4

imagor - v1.2.3

Published by cshum almost 2 years ago

What's Changed

Full Changelog: https://github.com/cshum/imagor/compare/v1.2.2...v1.2.3