# Fingerprint for images (how?)

**URL:** <https://discourse.gohugo.io/t/fingerprint-for-images-how/15742>\
**Category:** support\
**Created:** [December 9, 2018, 3:25pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742 "2018-12-09T15:25:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Cabrera](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Javier\_Cabrera](https://discourse.gohugo.io/u/Javier_Cabrera)\
**Post date:** [December 9, 2018, 3:25pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/1 "2018-12-09T15:25:47Z")

</div>

Howdy there!

I’m scratching my head trying to figure out the way to **setup and use the fingerprint feature for** my **website images**. I’ve gone through the docs already looking for the answer and while it does mentions images and fingerprinting, it does so very briefly, only showing a real use case for stylesheets (much appreciate for that one!)

Can someone lend a hand please?

Thanks in advance.

Cheers!

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [December 9, 2018, 3:37pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/2 "2018-12-09T15:37:51Z")

</div>

With images in the **`assets/` directory** , you simply do `resources.Get "<IMAGE PATH>" | fingerprint`.

If the images are not a `assets/` directory, they need to be in a _page bundle_ (someone correct me if that’s wrong).

[Example](https://gitlab.com/kaushalmodi/hugo-theme-refined/blob/05dd5f8ff48e30221a74e6bfd707672d1227daaa/layouts/partials/head.html#L141-145)

---

<div class="post-metadata">

**Author:** ![Javier\_Cabrera](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Javier\_Cabrera](https://discourse.gohugo.io/u/Javier_Cabrera)\
**Post date:** [December 9, 2018, 3:48pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/3 "2018-12-09T15:48:28Z")

</div>

Ohhhh I see how that works. Thanks! 😉

But how does it work for images that aren’t in the assets directory? I’ve got a bunch of images in “content/post/img”. Do all my images need to go inside the assets directory? Even those in the posts?

Currently, my images live inside the `content/issue-X/` folder of every issue of my magazine. I COULD move my images to `assets/issue-X/` but then I will have to also add that issue-x to the path of my image and that will break my template.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [December 9, 2018, 3:52pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/4 "2018-12-09T15:52:32Z")

</div>

> [@Javier\_Cabrera](#):
>
> Currently, my images live inside the `content/issue-X/` folder of every issue of my magazine. I COULD move my images to `assets/issue-X/` but then I will have to also add that issue-x to the path of my image and that will break my template.

You wouldn’t have to change the image path if you used `.GetMatch` and wildcards

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [December 9, 2018, 3:53pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/5 "2018-12-09T15:53:29Z")

</div>

> [@Javier\_Cabrera](#):
>
> I COULD move my images to `assets/issue-X/` but then I will have to also add that issue-x to the path of my image and that will break my template.

As I mentioned, the alternative would be to make your pages **Page Bundles** (with `index.md` or `_index.md` as suitable) instead of regular pages.

---

<div class="post-metadata">

**Author:** ![Javier\_Cabrera](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Javier\_Cabrera](https://discourse.gohugo.io/u/Javier_Cabrera)\
**Post date:** [December 9, 2018, 9:18pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/6 "2018-12-09T21:18:12Z")

</div>

Question, because I might not have understood how this work correctly.

I went full fingerprint with my css files.

Instead of `css/style.css` now I have `css/style.938toasdijgokadsn0a9w5.css`

Every time I upload this to my CDN provider (cloudfront), do I need to also update all the html files linking to that .css? Because the fingerprint number will change each time, right? That means, the link will change too.

So, If I have **400 html** files and **1 css** file:

**Change**  
from

```auto
h1 { color: black; }

```

to

```auto
h1 { color: red; }

```

**Before**

1. Upload **style.css**
2. Invalidate `css/style.css`
3. Drink grog

**NOW**

1. Upload **style.csao8i9tu89a.css**
2. Upload **400 html** files scattered through **20 folders**.
3. Cry
4. Drink grog.

Is that correct?

if it is, the only thing that I save is not having to invalidate one file, but have to pay for **400 file uploads**. Not sure that’s the expected result…

Cheers.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [December 9, 2018, 10:03pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/7 "2018-12-09T22:03:49Z")

</div>

@Javier_Cabrera please open your own thread about this remotely related topic.

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [December 10, 2018, 1:04pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/8 "2018-12-10T13:04:42Z")

</div>

I upload Hugo content and theme to the server and run hugo on the server. Syncing the content ist a lot faster for me. Could be a way for other users.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [December 10, 2018, 7:20pm UTC](https://discourse.gohugo.io/t/fingerprint-for-images-how/15742/9 "2018-12-10T19:20:57Z")

</div>


