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: $data['validation']->setRules([ 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.
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() ->withFile($source) ->fit(100, 100, 'center') ->save($targetDirectory.'/'.$newName); }
You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.
|
Welcome Guest, Not a member yet? Register Sign In |