# Resize on upload as page option

**URL:** <https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693>\
**Category:** Questions\
**Tags:** v2\
**Created:** [June 9, 2017, 5:03pm UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693 "2017-06-09T17:03:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![thewebprojects](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thewebprojects/32/10107_2.png) [@thewebprojects](https://forum.getkirby.com/u/thewebprojects)\
**Post date:** [June 9, 2017, 5:03pm UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/1 "2017-06-09T17:03:04Z")

</div>

Hello. I’ve seen plugins that allow you to set a max-size upon the user uploading to any/every page within the panel, but is anything available that would allow the max-size to be set per template? It’s very common to have an extra large image on the home page for a hero graphic, but only need say 800 px width images for pretty much every other page. Thoughts?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 9, 2017, 11:05pm UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/2 "2017-06-09T23:05:15Z")

</div>

You can limit the size of images that can be uploaded via your blueprints using the size option:

```auto
files:
    size: 12000000

```

[https://getkirby.com/docs/panel/blueprints/file-settings#file-limits](https://getkirby.com/docs/panel/blueprints/file-settings#file-limits)

---

<div class="post-metadata">

**Author:** ![thewebprojects](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thewebprojects/32/10107_2.png) [@thewebprojects](https://forum.getkirby.com/u/thewebprojects)\
**Post date:** [June 9, 2017, 11:27pm UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/3 "2017-06-09T23:27:00Z")

</div>

Thanks for the reply.

Isn’t that file size? I’m referring to dimensions.

Consider the average client. They find the image they want. They do not know what file size or width or height it is. They’re just glad they got this far and now they want to dump this massively large file into the CMS to be used on the page. We can resize at the template level but I don’t want these massive files sitting on the server takin’ up my SSD space (which isn’t cheap). If a client gets hit with an error stating that the file size is too large they just call me.

I think a valuable feature would be to allow the dev to set a max-width and/or height to uploaded images. This would be set at the blueprint just like ‘size’ is. And as extra credit perhaps do this on client-side. Consider [this](http://tinyurl.com/ybd4yj78) for clarity.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 9, 2017, 11:35pm UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/4 "2017-06-09T23:35:18Z")

</div>

Ok, that wasn’t clear from your first post, but just underneath the size there is also an width and height option.

Apart from that, you could of course use a hook to auto-resize images on the server side.

As regards server-side resizing, you could create a feature request in the Panel repo.

---

<div class="post-metadata">

**Author:** ![thewebprojects](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thewebprojects/32/10107_2.png) [@thewebprojects](https://forum.getkirby.com/u/thewebprojects)\
**Post date:** [June 9, 2017, 11:38pm UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/5 "2017-06-09T23:38:21Z")

</div>

Right. “max-size” didn’t help matters. I never got into exploring hooks and such. I suppose I should.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 9, 2017, 11:39pm UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/6 "2017-06-09T23:39:50Z")

</div>

I was referring to this option:

```auto
files:
    width: 500
    height: 300

```

Doesn’t it work?

---

<div class="post-metadata">

**Author:** ![thewebprojects](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thewebprojects/32/10107_2.png) [@thewebprojects](https://forum.getkirby.com/u/thewebprojects)\
**Post date:** [June 10, 2017, 12:06am UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/7 "2017-06-10T00:06:42Z")

</div>

Does this resize the file on upload?

Or does it just throw an error if it’s not, say 500 x 300?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 10, 2017, 6:29am UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/8 "2017-06-10T06:29:20Z")

</div>

No, it just throws an error.

As I said, if you want to resize images, you would have to use a hook, if you use an if statement inside that hook, you can do different things depending on template.

See this solution: [https://gist.github.com/samnabi/f4ecb351f2ec2bd596e5](https://gist.github.com/samnabi/f4ecb351f2ec2bd596e5)

---

<div class="post-metadata">

**Author:** ![thewebprojects](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thewebprojects/32/10107_2.png) [@thewebprojects](https://forum.getkirby.com/u/thewebprojects)\
**Post date:** [June 10, 2017, 10:37am UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/9 "2017-06-10T10:37:00Z")

</div>

As always, thanks for the useful info Sonja. I’ll review this further.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:49pm UTC](https://forum.getkirby.com/t/resize-on-upload-as-page-option/7693/10 "2025-02-06T16:49:49Z")

</div>

Archived on February 6, 2025, 4:49pm UTC


