Flickr . !
Feature này được develop để đưa photos download từ Flickr qua XGallery lên thẳng Google Drive luôn. Như vậy giảm tải cho local storage, dễ dàng sharing hơn. Tất nhiên cái giá phải trả là trả cho Google Drive.
Vậy feature này work sao
- Dĩ nhiên đầu tiên là download photos ( original size – best size ) từ Flickr
- Sync với Google Drive
Nếu xài OAuth thì 1 chút phiền phức trong việc implement API cho OAuth nên thôi sử dụng GDrive binary. Như vậy sau khi download xong sẽ sync ( toàn bộ folder của “owner” Flickr đó lên Google Drive. Sau đó sẽ xoá local.
$process = new Process(['./gdrive.sh']);
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
Storage::delete($filePath);
Cách làm này “tiện” cho developer . Nhưng với end users thì … chắc mệt. Vì phải build binary từ source của GDrive ( Go ). Vì sao phải build mà không dùng thẳng uh ? Vì phải update lại 1 số key trong GDrive
https://github.com/gdrive-org/gdrive/issues/506
Tuy nhiên việc install này cũng khá simple
- Install go
- `go get github.com/prasmussen/gdrive`
- go build
Rồi. Giờ authenticate với Google là xong
Còn file bash script chẳng qua để tiện xài thôi.
#!/bin/sh
gdrive/gdrive sync upload ./storage/app/flickr 18Wi-wHgjgp8JgTijv7rTgH0tAuqvPZM6
Leave a Reply