Welcome Guest, Not a member yet? Register   Sign In
Image manipulation

(This post was last modified: 07-30-2017, 05:03 PM by jarmen_kell. Edit Reason: CI Forum's auto formatting bb tags mess up my pasted code )

(07-30-2017, 12:20 PM)theedo Wrote: Thank you for the suggestion about thumbnail, I'll use this.

But, I don't need the get file size function.. I want that when an user upload an image the real image pass through a "compression" to reduce the size, some idea?

there're lot's of other image manipulation lib from composers' Packagist of you feel like want to try exploring it.
but if you insist on using CI's own library. you might wanted to make it a little bit more creative.

when you'r user upload an image using CI's own File Uploading lib,
it'll return all of the information on the uploaded file image, and few of it are your uploaded image's Width and Height:
PHP Code:

now you've got your file's original "width" and "height",
lets parse it into CI's Image Manipulation lib config init
with additional options, that is the "quality" option:
PHP Code:
['image_library'] = 'gd2';
$config['maintain_ratio'] = TRUE;
$config['width' $uploadedFile['image_width'];
$config['height'] = $uploadedFile['image_height'];
$config['quality'] = '70%';  // this 'might' compress your image



please CMIIW

Messages In This Thread
Image manipulation - by theedo - 07-29-2017, 11:39 PM
RE: Image manipulation - by InsiteFX - 07-30-2017, 04:33 AM
RE: Image manipulation - by theedo - 07-30-2017, 12:20 PM
RE: Image manipulation - by jarmen_kell - 07-30-2017, 05:01 PM
RE: Image manipulation - by Diederik - 07-30-2017, 02:08 PM
RE: Image manipulation - by InsiteFX - 07-30-2017, 05:22 PM
RE: Image manipulation - by Martin7483 - 07-31-2017, 12:43 AM

Theme © iAndrew 2016 - Forum software by © MyBB