[COMPONENT][Attachment][Posting] Move onHashFile from Posting to Attachment. Remove onGetAllowedThumbnailSizes

This commit is contained in:
2021-12-08 20:35:59 +00:00
parent 614e02b4c6
commit e9dfa0f08c
2 changed files with 12 additions and 20 deletions

View File

@@ -251,24 +251,4 @@ class Posting extends Component
return Event::next;
}
}
/**
* Get a unique representation of a file on disk
*
* This can be used in the future to deduplicate images by visual content
*/
public function onHashFile(string $filename, ?string &$out_hash): bool
{
$out_hash = hash_file(Attachment::FILEHASH_ALGO, $filename);
return Event::stop;
}
/**
* Fill the list with allowed sizes for an attachment, to prevent potential DoS'ing by requesting thousands of different thumbnail sizes
*/
public function onGetAllowedThumbnailSizes(?array &$sizes): bool
{
$sizes[] = ['width' => Common::config('thumbnail', 'width'), 'height' => Common::config('thumbnail', 'height')];
return Event::next;
}
}