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

I can't understand what the syntax for image manipulation is. I have this in my controller, which moves the renamed image to the folder and saves its name in the database.

However, I would like to manage the resize, but I cannot understand where to act. This is my controller:

PHP Code:
            'first_name' => ['label' => 'First Name''rules' => 'required|min_length[3]|max_length[150]'],
            'last_name' => ['label' => 'Last Name''rules' => 'required|min_length[5]|max_length[150]'],
            'bio' => ['label' => 'Bio''rules' => 'required|min_length[15]'],
            'category' => ['label' => 'Category''rules' => 'required'],
            'photo' => ['label' => 'Photo''rules' => 'uploaded[photo]|max_size[photo,1024]'],
if($this->request->getPost() && $data['validation']->withRequest($this->request)->run()) {

            // store photo in folder writable/uploads/photos
            if($imagefile $this->request->getFiles('photo')){
                if($img $imagefile['photo']){
                    if($img->isValid() && ! $img->hasMoved()){
                        $newName $img->getRandomName();
= [
                'first_name' => $this->request->getVar('first_name'),
                'last_name'  => $this->request->getVar('last_name'),
                'bio'  => $this->request->getVar('bio'),
                'category'  => $this->request->getVar('category'),
                'photo' => $newName,


Where should I enter this?

PHP Code:
$image = \Config\Services::image()

I don't need you to upload two photos (original and miniature), but only the reduced image.

(This post was last modified: 04-14-2020, 03:58 PM by Leo.)

I did this 2 days ago! Or yesterday maybe...

basically, you don't need this (unless you want to run more security checks on the file before moving itto desired folder? or keep the original?): $img->move(WRITEPATH.'uploads/photos', $newName);
just fiddle with the temporary upload path

if($img->isValid() && ! $img->hasMoved()){
$newName = $img->getRandomName();
//$img->move(WRITEPATH.'uploads/photos', $newName); <--- not needed
$source = $img->getTempName();
$image = \Config\Services::image()
->fit(100, 100, 'center')
You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.

Great, thank you very much.

Theme © iAndrew 2016 - Forum software by © MyBB