Subscribe
Dapatkan berita terbaru seputar startup dan inspirasi technopreneurship dengan berlangganan newsletter Grevia.

 

Crop Image

http://stackoverflow.com/questions/16778801/how-to-crop-image-using-ajax-jquery-in-codeigniter
Setup image permission

Jalankan image temp writable di server script
chmod 0755 /usr/share/nginx/html/temp/
chown nginx:nginx /usr/share/nginx/html/temp/ 
lalu di server static enable permission di
chmod 0755 /usr/share/nginx/html/temp/
chmod 0755 /usr/share/nginx/html/temp/files
chown nginx:nginx /usr/share/nginx/html/temp
chown nginx:nginx /usr/share/nginx/html/temp/files
Untuk meng-crop image
//crop it
$data['x'] = $this->input->post('x');
$data['y'] = $this->input->post('y');
$data['w'] = $this->input->post('w');
$data['h'] = $this->input->post('h');
$config['image_library'] = 'gd2';
//$path = 'uploads/apache.jpg';
$config['source_image'] = 'uploads/'.$data['user_data']['img_link']; //http://localhost/resume/uploads/apache.jpg
// $config['create_thumb'] = TRUE;
//$config['new_image'] = './uploads/new_image.jpg';
$config['maintain_ratio'] = FALSE;
$config['width'] = $data['w'];
$config['height'] = $data['h'];
$config['x_axis'] = $data['x'];
$config['y_axis'] = $data['y'];
$this->load->library('image_lib', $config);
if(!$this->image_lib->crop())
{	echo $this->image_lib->display_errors();
}
redirect('profile');
Follow Grevia :         
Daftar Email anda ke newsletter.
Copyright © 2011 - 2022. Grevia Networks
×