hugo/resource
Bjørn Erik Pedersen d8fdffb552
resource: Fix multi-threaded image processing issue
When doing something like this with the same image from a partial used in, say, both the home page and the single page:

```bash
{{ with $img }}
{{ $big := .Fill "1024x512 top" }}
{{ $small := $big.Resize "512x" }}
{{ end }}
```

There would be timing issues making Hugo in some cases try to process the same image with the same instructions in parallel.

You would experience errors of type:

```bash
png: invalid format: not enough pixel data
```

This commit works around that by adding a mutex per image. This should also improve the performance, sligthly, as it avoids duplicate work.

The current workaround before this fix is to always operate on the original:

```bash
{{ with $img }}
{{ $big := .Fill "1024x512 top" }}
{{ $small := .Fill "512x256 top" }}
{{ end }}
```

Fixes #4404
2018-02-15 09:41:29 +01:00
..
testdata resource: Fix handling of very long image file names 2018-01-15 20:22:14 +01:00
image.go resource: Fix multi-threaded image processing issue 2018-02-15 09:41:29 +01:00
image_cache.go resource: Fix multi-threaded image processing issue 2018-02-15 09:41:29 +01:00
image_test.go resource: Fix multi-threaded image processing issue 2018-02-15 09:41:29 +01:00
resource.go resource: Make resource counters for name and title independent 2018-01-29 10:44:09 +01:00
resource_test.go resource: Make resource counters for name and title independent 2018-01-29 10:44:09 +01:00
smartcrop.go resource: Add smart cropping 2018-02-05 13:59:15 +01:00
testhelpers_test.go resource: Fix multi-threaded image processing issue 2018-02-15 09:41:29 +01:00