Transform gallery partial in gallery shortcode

I am implementing successfully a gallery partial using the resources feature as follows:

<div id="portfolio">
{{ with .Resources.ByType "image" }}
{{ range . }}
{{ $scaled := .Resize "x300" }}
<div class="tile">
<a href="{{ .Permalink }}" data-href="{{ $scaled.Permalink }}" class="progressive replace">
<img src="{{ .Permalink }}" class="preview" alt="{{ with $.Page.Params.title }}{{ . }}{{ end }}"></a></div>
{{ end }}{{ end }}
</div>

It works as a partial, but now I would like to use the same feature in a shortcode such as

{{% gallery folder="" title="" %}}
The folder should be a subfolder of the page bundle.

I tried to follow the same route as the one described in this post but no success.
Need some help.

I would call the partial from the shortcodes/gallery.html and pass the arguments along the page object in a dict.

{{/* from shortcodes/gallery.html /*}}
{{ partial "gallery" (dict "page" $.Page "folder" (.Get "folder") "title" (.Get "title") ) }}

Now whenever you need to access the page’s info from your partial, you’ll use .page

Could not test it.

Thank you.
It still doesn’t work. I didn’t get any error (fron Hugo) and neither any images displayed.
I guess it’s the way the argument “folder” is meant to be passed to the partial because currenly my partial doesn’t have any argument.