Haloo! Selamat Datang di Komunitas Private Training Web Development (46539 Members, 430 Projects, 3580 Topic, 9792 Comments)

Butuh karyawan baru? atau seorang Web Developer (Part-time/Freelance/Full-time), cari disini : Members Area Jobs!
CMS swarakalibata - thumbnail/Image Resize dengan Codeignitter
Agus Hariyanto Mengatakan : Members -
Rate Topic :
  1. Assalamualaikum Warahmatullahi Wabarakatuh...
  2.  
  3. Mohon bantuannya para master disini. Gimana ya caranya agar saat upload berita dengan CMS swarakalibata Code Ignitter itu bisa upload foto asli dan foto yang diresizer sebgai thumbnail seperti pada project cms lokomedia.
  4. Terima kasih sharing ilmunya
Robby Prihandaya Mengatakan :
Admin -
  1. Assalamualaikum,.. tambahkan pada config upload file/image menjadi seperti ini :
  2. $config['image_library'] = 'gd2';
  3. $config['source_image'] = 'asset/foto_berita/'.$hasil['file_name']; // thumbnail disimpan pada folder yang sama
  4. $config['create_thumb'] = TRUE;
  5. $config['maintain_ratio'] = TRUE;
  6. $config['height'] = 622;
  7. $this->load->library('image_lib', $config);
  8. $this->image_lib->crop();
  9.  
  10. echo $hasil['raw_name']; // Simpan hasil crop/thumbnail ke database...

Agus Hariyanto Mengatakan :
Members -
  1. Assalamualaikum,..
  2. Terima kasih master

Agus Hariyanto Mengatakan :
Members -
  1. Assalamualaikum,..
  2.  
  3. Saya coba terapkan pada CMS web portal kampus https://members.phpmu.com/files/detail/web-portal-kampus-responsove-dengan-framework-codeigniter-3x kok gak bisa ya.

Agus Hariyanto Mengatakan :
Members -
  1. Assalamualaikum,..
  2. berikut perubahannya, mohon koreksinya
  3.  
  4. function list_berita_tambah(){
  5. $config['upload_path'] = 'asset/foto_berita/';
  6. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  7. $config['max_size'] = '3000'; // kb
  8.  
  9.  
  10. $config['image_library'] = 'gd2';
  11. $config['source_image'] = 'asset/foto_berita/'.$hasil['file_name']; // thumbnail disimpan pada folder yang sama
  12. $config['create_thumb'] = TRUE;
  13. $config['maintain_ratio'] = TRUE;
  14. $config['height'] = 622;
  15. $this->load->library('image_lib', $config);
  16. $this->image_lib->crop();
  17.  
  18.  
  19.  
  20. $this->load->library('upload', $config);
  21. $this->upload->do_upload('k');
  22. $hasil=$this->upload->data();

Bukhori Muslim Mengatakan :
Admin -
  1. Assalamualaikum,.. coba cek di dalam folder asset/foto_berita gan,
  2. harusnya ada 2 file saat upload foto berita.

Agus Hariyanto Mengatakan :
Members -
  1. Assalamualaikum,..
  2. Sudah saya cek, dan hanya file asli yang terupload

Bukhori Muslim Mengatakan :
Admin -
  1. Assalamualaikum,.. coba perbaiki jadi gini :
  2. function list_berita_tambah(){
  3. $config['upload_path'] = 'asset/foto_berita/';
  4. $config['allowed_types'] = 'gif|jpg|png|JPG|JPEG';
  5. $config['max_size'] = '3000'; // kb
  6. $this->load->library('upload', $config);
  7. $this->upload->do_upload('k');
  8. $hasil=$this->upload->data();
  9.  
  10. $config['image_library'] = 'gd2';
  11. $config['source_image'] = 'asset/foto_berita/'.$hasil['file_name']; // thumbnail disimpan pada folder yang sama
  12. $config['create_thumb'] = TRUE;
  13. $config['maintain_ratio'] = TRUE;
  14. $config['height'] = 622;
  15. $this->load->library('image_lib', $config);
  16. $this->image_lib->crop();
  17.  
  18. $thumb_foto = $hasil['raw_name'].'_thumb'.$hasil['file_ext'];

Maaf, Untuk Memberikan Komentar Anda Harus Login !!!