Skip to content
Resize images in the browser before uploading them to the server.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
index.js
index.php
readme.md update known issues May 10, 2019

readme.md

Resize images in the browser before uploading them to the server.

Install

Download and copy folder into your plugins directory.

Use

On a files section, set the maxpixels property.

Example

my_image_section:
  type: files
  maxpixels: 2000000 #two million pixels

Now, when a user tries to upload a 9000x12000 pixel image, this image will be resized to 1224x1632, which are 1'997'568 pixels.

But why?

Servers have limited resources.

Trying to resize a 9000x12000 pixels large image to 1224x1632 pixels, requires at least:

(9000 * 12000 + 1224 * 1632) * 4bytes ~= 440MB of RAM.

If your shared hosting provider limits your max RAM per request to 256MB, you won't ever be able to resize the image on your server.

Known issues

  • On Microsoft Edge, resized images are renamed to "blob". (Both the release of Kirby 3.2 and the adoption of V8 in Edge should solve this issue).
  • Files replaced from inside the File view will not be resized. (see issue #2)
You can’t perform that action at this time.