• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Resize after upload

#1
Good day, am trying to resize on upload, seems not to be working out. it shows this error "imagecopyresampled(): supplied resource is not a valid Image resource" after resizing to just one folder.
PHP Code:
if ($imagefile $this->request->getFile('avatar'))
         
  {
         
      if ($imagefile->isValid() && ! $imagefile->hasMoved())
                {
                    
$path FCPATH.'profile/';
     
            $filename $imagefile->getRandomName();
     
            $file_full_path $path $filename;
                 
  if($imagefile->move($path$filename))
                 
  {
                     
  $sizes = array('600','920','200');
             
           foreach ($sizes as $size)
                        {
                         
  $resizepath $imagefile->setPath($path.$size.'/');
                            \
Config\Services::image('gd')
                         
       ->withFile($file_full_path)
                         
           ->resize($size230,true'height')
                         
       ->save($resizepath.$filename);
                        }
                        
$result['status'] = 200;
     
                $result['image'] = $path.'200/'.$filename;
                    }

                }
            } 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.