12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- defined('GNUSOCIAL') || die();
- class Attachment_thumbnailAction extends AttachmentAction
- {
- protected $thumb_w = null;
- protected $thumb_h = null;
- protected $thumb_c = null;
- protected function doPreparation()
- {
- parent::doPreparation();
- $this->thumb_w = $this->int('w');
- $this->thumb_h = $this->int('h');
- $this->thumb_c = $this->boolean('c');
- }
-
- public function showPage(): void
- {
-
- try {
- $thumbnail = $this->attachment->getThumbnail($this->thumb_w, $this->thumb_h, $this->thumb_c);
- $file = $thumbnail->getFile();
- } catch (UseFileAsThumbnailException $e) {
-
- $file = $e->file;
- } catch (FileNotFoundException $e) {
- $this->clientError(_m('No such attachment'), 404);
- }
-
-
-
- @ini_set('display_errors', 0);
- header("Content-Description: File Transfer");
- header("Content-Type: {$this->mimetype}");
- header("Content-Disposition: inline; filename=\"{$this->filename}\"");
- header('Expires: 0');
- header('Content-Transfer-Encoding: binary');
- parent::sendFile();
- }
- }
|