Google Drive Thumbnail Codeigniter Library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
libraries/Gdthumb
README.md

README.md

gdthumb

Codeigniter library untuk mendapatkan thumbnail/preview file dokumen (pdf,doc) pada Google Drive.

Instalasi

Copy folder gdthumb ke "application/libraries/"

Contoh Penggunaan

Memuat library

$this->load->library('gdthumb');

Menyeting Google Developer Key

$this->gdthumb->setGoogleKey('API_KEY_HERE');

Melaukan request

$this->gdthumb->thumbnail('DRIVE_ID');

Alternative Parameters | Parameter | Keterangan | | --- | --- | | size | Ukuran yang dihasilkan thumbnail | | path | Lokasi untuk menyimpan hasil thumbnail | | filename | Nama file untuk menyimpan hasil thumbnail |

Contoh dengan parameters

$params['size'] = 500; //default 220
$params['path'] = ".downloads/thumbnail/";
$params['name'] = "thumbnail1.png"; //default: [driveid].png

Contoh Code

Dengan content-type

header("Content-Type: image/png");
$this->load->library('gdthumb');
$this->gdthumb->setGoogleKey('API_KEY_HERE');
$this->gdthumb->thumbnail('DRIVE_ID_HERE');

Menyimpan File

$this->load->library('gdthumb');
$this->gdthumb->setGoogleKey('API_KEY_HERE');
$params['size'] = 500;
$params['path'] = "./download/thumbnails/";
$params['name'] = "thumbnail.png"; //default: [driveid].png
$this->gdthumb->thumbnail('DRIVE_ID_HERE', $params);

Google Developer Key

  • Kunjungi Goggle Console
  • Aktifkan Google Drive API pada menu Library
  • Buat API Key pada menu Credentials