Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused processed images should not be copied to /public #6266

Closed
bep opened this issue Aug 26, 2019 · 1 comment

Comments

@bep
Copy link
Member

commented Aug 26, 2019

I discovered this while tightening up the test suite in this department. One could argue that these images don't hurt anyone, and it was probably implemented like this so speed things up, but they take up disk space and should not be there.

This is a common pattern:

{{ $original := resources.Get "sunset.img" }}
{{ $firstStep := $original.Resize "400x" }}
{{ $thumb := $firstStep.Fill "100x100" }}
{{ $thumLarge := $firstStep.Fill "200x200" }}

<img src="{{  $thumb.RelPermalink }}" />
<img src="{{  $thumbLarge.RelPermalink }}" />

Currently, all the processed versions of that image (including $firstStep) will be copied to /public. This will be even more visible once we add image filters to the mix.

These should follow the rules of how the transformations in Hugo Pipes works (e.g. fingerprint, resources.Get):

A processed image will only be published (copied to /public) if one of .RelPermalink or .Permalink is called on that processed image.

/cc @regisphilibert

@bep bep added the Bug label Aug 26, 2019

@bep bep added this to the v0.58 milestone Aug 26, 2019

@bep bep self-assigned this Aug 26, 2019

bep added a commit to bep/hugo that referenced this issue Aug 26, 2019
Image resource refactor
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend.

This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below:

    {{ ($myimg | fingerprint ).Width }}

Fixes gohugoio#5903
Fixes gohugoio#6234
Fixes gohugoio#6266
bep added a commit to bep/hugo that referenced this issue Aug 26, 2019
Image resource refactor
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend.

This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below:

    {{ ($myimg | fingerprint ).Width }}

Fixes gohugoio#5903
Fixes gohugoio#6234
Fixes gohugoio#6266
bep added a commit to bep/hugo that referenced this issue Aug 26, 2019
Image resource refactor
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend.

This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below:

    {{ ($myimg | fingerprint ).Width }}

Fixes gohugoio#5903
Fixes gohugoio#6234
Fixes gohugoio#6266
bep added a commit to bep/hugo that referenced this issue Aug 26, 2019
Image resource refactor
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend.

This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below:

    {{ ($myimg | fingerprint ).Width }}

Fixes gohugoio#5903
Fixes gohugoio#6234
Fixes gohugoio#6266
bep added a commit to bep/hugo that referenced this issue Aug 26, 2019
Image resource refactor
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend.

This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below:

    {{ ($myimg | fingerprint ).Width }}

Fixes gohugoio#5903
Fixes gohugoio#6234
Fixes gohugoio#6266
@regisphilibert

This comment has been minimized.

Copy link

commented Aug 26, 2019

Yes makes sense, and as the rule keeps being enforced, I think it's time to introduce #6267

@bep bep closed this in f9978ed Aug 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.