Admin area - Fly resize image

Update at 2017-12-22 07:58:21


Introduce

On a typical website up to 30% is the image. Therefore, optimizing images with a reasonable size is a common practice for a web application.

Imagine, you upload an image of size "1000x1000" but your purpose for this photo is just "100x100" is enough, so you wasted up to 90% left.

CI Base provides an api that allows you to resize your images to the size you want, resizing images to be cached for future use.

Use

First thing to note is that CI Base will only resize that image when it's on your site (can not be located on the 3rd site).

Use

http://yourdomain.com/admin.php/photo/resize/[width]x[scene/path/to/your/image

Inside:

[width]: width (integer)
[height]: height (integer)
path/to/your/image: is the relative path of the image (from the root of the domain)
For example

http://yourdomain.com/admin.php/photo/resize/100x/storage/no-avatar.png

You can also configure the path at admin/routes/web.php