# Image Processing - prevent url change

**URL:** <https://discourse.gohugo.io/t/image-processing-prevent-url-change/38868>\
**Category:** support\
**Created:** [May 30, 2022, 10:46pm UTC](https://discourse.gohugo.io/t/image-processing-prevent-url-change/38868 "2022-05-30T22:46:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roger](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/roger/32/14113_2.png) [@Roger](https://discourse.gohugo.io/u/Roger)\
**Post date:** [May 30, 2022, 10:46pm UTC](https://discourse.gohugo.io/t/image-processing-prevent-url-change/38868/1 "2022-05-30T22:46:34Z")

</div>

Currently, at least from my use, when using hugo’s image processing, Hugo changes the URI of the image, so currently:

busy-city-tn.jpg

Becomes:

busy-city-tn\_hu25881f39380c36b0fad3ff6d6d89aa82\_807081\_760x0\_resize\_q100\_box.jpg

Is their a way to prevent this name change OR is their a way to predict that name change?

As I might be asking the wrong question, the issue I would like to resolve is:

Front matter:

```auto
---

thumbnail: /images/busy-city.jpg

---

```

This is used in the respective layout to generate a thumbnail used on a HUGO list page.

Buenicimo Perfect.

THEN, later, I have a search function with JS, it all works. I output all I need to search through using Hugo’s config output with a /index.json. I fetch that all is happy.  
I have the above front matter in the index.json file: thumbnail: /images/images/busy-city.jpg

But as image processing has changed the URL, I now have to with JS, I think, fetch the page where the image appears, with regex compare to find that images new URL, and now display.

Preferably, I can just set the URL to not change on build or to predictably change (i.e. append “processed…”)

This might be a super isolated use case, but if their is a way, it would really help me.

Thank you for everyone’s’ time.

---

<div class="post-metadata">

**Author:** ![Roger](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/roger/32/14113_2.png) [@Roger](https://discourse.gohugo.io/u/Roger)\
**Post date:** [May 30, 2022, 11:15pm UTC](https://discourse.gohugo.io/t/image-processing-prevent-url-change/38868/2 "2022-05-30T23:15:36Z")

</div>

Sometimes, you just need to get a stupid question out of your soul to see the answer…

I’m just going to create a new hugo processed link of the thumbnail to use in the search in the index.json template.

In case their is better, wanted to leave this here.

---

<div class="post-metadata">

**Author:** ![techmagus](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/techmagus/32/16997_2.png) [@techmagus](https://discourse.gohugo.io/u/techmagus)\
**Post date:** [May 30, 2022, 11:22pm UTC](https://discourse.gohugo.io/t/image-processing-prevent-url-change/38868/3 "2022-05-30T23:22:57Z")

</div>

If I understood the question the correctly, support for your request is coming in v0.100.0: `resources.Copy`.

An example from the source issue page:

```auto
{{ $resized := $image.Resize "400x400" | resources.Copy "images/mynewname.jpg" } }}
<img src="{{ $resized.RelPermalink }}">

```

See:

> <https://github.com/gohugoio/hugo/issues/9934>
>
> \* #9925
> \* #9885
> \* #9944
> 
> \## .RenderString with shortcodes
> 
> And finally, yo…u can now use shortcodes in the strings pased to \`.RenderString\` See #6703 for more information.
> 
> \## Preserve indentation for shortcode blocks
> 
> Hugo now preserves the indentation for shortcode blocks. That is when the shortcode is included as the first non-whitespace content on a line. Note that this does not touch shortcodes with inner content, where the user is in control of the indentation. See issue #9946 for more information. An example, say that I have this in \`layouts/shortcodes/mylist.md\`:
> 
> \`\`\`md
> \* Culpa enim incididunt fugiat id dolore velit laboris veniam minim.
> \* Tempor ex nisi labore ad elit laborum ex ullamco aute labore eu occaecat. 
> \* Deserunt mollit aliqua est laboris et irure eu non. 
> \* Consectetur nulla minim non reprehenderit Lorem elit dolore quis.
> \`\`\`
> 
> And then use that shortcode in a content file:
> 
> \`\`\`md
> \* My List
> {{% mylist %}}
> \`\`\`
> 
> In earlier versions of Hugo the above would render as:
> 
> \<img width="582" alt="image" src="https://user-images.githubusercontent.com/394382/170958104-36a4673f-e51a-4b37-b0e8-6a0fda476929.png"\>
> 
> Now it renders as:
> 
> \<img width="604" alt="image" src="https://user-images.githubusercontent.com/394382/170957864-028d1e64-b383-4681-b844-f9075e04d8ff.png"\>
> 
> Note that in the example above we use the \`md\` file suffix for the shortcode. In this release we also added \`Markdown\` as a built-in output format in Hugo, defined as a plain text format, meaning you get more lenient parsing compared to HTML. Using this if your shortcode produces Markdown has fewer quirks. See #9821.
> 
> \## resources.Copy
> 
> \`\`\`htmlbars
> {{ $resized := $image.Resize "400x400" | resources.Copy "images/mynewname.jpg" } }}
> \<img src="{{ $resized.RelPermalink }}"\>
> \`\`\`

---

<div class="post-metadata">

**Author:** ![Roger](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/roger/32/14113_2.png) [@Roger](https://discourse.gohugo.io/u/Roger)\
**Post date:** [May 31, 2022, 12:25am UTC](https://discourse.gohugo.io/t/image-processing-prevent-url-change/38868/5 "2022-05-31T00:25:03Z")

</div>

Thanks mate, see below. That’s what I need… (but yet, I guess this future update might handle too).

> [@Change file name for resized image resources](https://discourse.gohugo.io/t/change-file-name-for-resized-image-resources/14219/8):
>
> Never say never. There is an open issue about creating a “rename function”, but I think people have succesfully used concat as a hacky workaround, e.g.: {{ $img := $img.Resize "100x100" }} {{ $img := slice $img | resources.Concat "favicon.png" }} Above is totally untested.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [June 16, 2022, 9:37pm UTC](https://discourse.gohugo.io/t/image-processing-prevent-url-change/38868/6 "2022-06-16T21:37:18Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
