@georgehrke Please check out the thumbnail_fixes branch. As far as I understood the logic lines https://github.com/owncloud/core/blob/master/lib/private/preview.php#L375 to https://github.com/owncloud/core/blob/master/lib/private/preview.php#L391 were partly redundant. That's the reason why I refactored them into `isCached()` and `isCachedBigger()`

Which brings me to your original comment. Instead of calling `isCachedBigger()` we could just return false. Then the issue @DeepDiver1975 described would go away but we would generate and save a preview thumbnail for every size requested. Which might be exploited by a malicious user to fill up the disk.

Maybe we should create a list of 'permanent' sizes. Gallery uses 200x200 (and should use the previews IMHO), Files uses 36x36, then the sizes requested by mobile / tablet clients. Could be a config variable:
```php
'permanentPreviewSizes' => array(
    array('x' => 36, 'y' => 36),
    array('x' => 200, 'y' => 200),
    //TODO add mobile sizes
    array('x' => 1000, 'y' => 1000),
),
```

@georgehrke @DeepDiver1975 what dou you think?