| @@ 397-402 (lines=6) @@ | ||
| 394 | if (isset($downloadUrl)) { |
|
| 395 | $request = new \Google_HttpRequest($downloadUrl, 'GET', null, null); |
|
| 396 | $httpRequest = \Google_Client::$io->authenticatedRequest($request); |
|
| 397 | if ($httpRequest->getResponseHttpCode() == 200) { |
|
| 398 | $tmpFile = \OC_Helper::tmpFile($ext); |
|
| 399 | $data = $httpRequest->getResponseBody(); |
|
| 400 | file_put_contents($tmpFile, $data); |
|
| 401 | return fopen($tmpFile, $mode); |
|
| 402 | } |
|
| 403 | } |
|
| 404 | } |
|
| 405 | return false; |
|
| @@ 50-59 (lines=10) @@ | ||
| 47 | ||
| 48 | if ($useFileDirectly) { |
|
| 49 | $absPath = $fileview->getLocalFile($path); |
|
| 50 | } else { |
|
| 51 | $absPath = \OC_Helper::tmpFile(); |
|
| 52 | ||
| 53 | $handle = $fileview->fopen($path, 'rb'); |
|
| 54 | ||
| 55 | // we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB. |
|
| 56 | // in some cases 1MB was no enough to generate thumbnail |
|
| 57 | $firstmb = stream_get_contents($handle, 5242880); |
|
| 58 | file_put_contents($absPath, $firstmb); |
|
| 59 | } |
|
| 60 | ||
| 61 | $result = $this->generateThumbNail($maxX, $maxY, $absPath, 5); |
|
| 62 | if ($result === false) { |
|