# Image processing from partial not working

**URL:** <https://discourse.gohugo.io/t/image-processing-from-partial-not-working/17424>\
**Category:** support\
**Created:** [March 7, 2019, 3:01am UTC](https://discourse.gohugo.io/t/image-processing-from-partial-not-working/17424 "2019-03-07T03:01:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brokenindexfinger](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@brokenindexfinger](https://discourse.gohugo.io/u/brokenindexfinger)\
**Post date:** [March 7, 2019, 3:01am UTC](https://discourse.gohugo.io/t/image-processing-from-partial-not-working/17424/1 "2019-03-07T03:01:30Z")

</div>

I’m deplying to Netlify, so I need to store all images that will be CMS-editable in a directory in /content, as documented in [this solution](https://github.com/netlify-templates/one-click-hugo-cms/issues/19). It works well in my layout files, but when I try to drop it into a partial it won’t work. I can print out $img below line 1 in the example below, but the `<img>` tag is never generated. I’m passing in the context when calling the partial: `{{ partial "person.html" . }}`. No errors when running the server or plain build script, nothing shows up with the `--verbose` option. Not sure what else I should be looking at to troubleshoot…

```
{{ $img := strings.TrimPrefix "/uploads/" .image }}
{{ $name := .name }}
{{ with $.Site.GetPage "page" "uploads/_index.md" }}
    {{ with .Resources.GetMatch $img }}
        {{$imgFill := .Fill "124x124 Center"}}
        <img class="" src="{{ $imgFill.RelPermalink }}" width="124" height="124" alt="Photo of {{ $name }}" tabindex="0">
    {{ end }}
{{ end }}
```

---

<div class="post-metadata">

**Author:** ![regis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/regis/32/4958_2.png) [@regis](https://discourse.gohugo.io/u/regis)\
**Post date:** [March 8, 2019, 4:50pm UTC](https://discourse.gohugo.io/t/image-processing-from-partial-not-working/17424/3 "2019-03-08T16:50:54Z")

</div>

Is this the code from your partial?

This code uses a map context with `.image` and `.name` and yet still tries to find the `.Site` variable in its root context ($).

Because you’re cautiously using `with` no error is produced, but unless you passed `.Site` to your partial map context as “Site”. There’s no chance for this `with` clause to pass successfully.

Now since Hugo 0.53, `.Site` is globally accessible through the namespace `site`. So you should be able to do what you need by replacing line 3 with

```auto
{{ with site.GetPage "page" "uploads/_index.md" }}

```

☝ Also, you don’t need to content type in the .GetPage calls anymore
