Read Detail

IMAGE CLASS

IMAGE CLASS dapat dilihat pada file kick/image/Image.php. Class ini berfungsi untuk ME-RESIZE FILE GAMBAR MENJADI GAMBAR THUMNAIL. Fungsi IMAGE CLASS adalah sebagai berikut :

resize

public function resize($imgPath, $width, $height, $saveFolder, $imageName, $type='pixel'){
    $params = array(
                    'imageFromPath'=>$imgPath
                    );
    $this->layer = new ImageWorkshop($params);
    if($type=='pixel'){
        $this->layer->resizeInPixel($width, $height, TRUE);   
        $this->layer->save($saveFolder, $imageName, FALSE);
    }else{
        die('Type not supported');
    }
}

Cara memanggil pada CONTROLLER.

$file = $_FILES;
$fileName = $this->upload->
uploadFile($file['image'], 'news', 'image');
if($fileName){
    $width = 300;
    $height = 250;
    $resizeMedia = 'thumb_'.$fileName;
    $path = UPLOADFOLDER . 'news/';
    $this->image->resize($path . $fileName, $width, $height, $path, $resizeMedia);
}