/** * Genarate and show preview of the image in file browser * @param string $key */ public function actionThumbnail($key) { try { $path = $this->baseFolderPath . "/" . $key; $image = Image::fromFile($path)->resize(60, 40); $image->save($this->tempDir . "/" . $this->thumbnailFileName($path)); @chmod($path, 0666); $image->send(); } catch (Exception $e) { Image::fromString(Image::EMPTY_GIF)->send(Image::GIF); } $this->terminate(); }