Closed MatthiasWeisz closed 3 years ago
@distantnative I guess Image::$validations overriden by File::$validations
But why? Image extends File and should override it, not the other way around. Need to look at this back in the computer.
Yes, you're right. I'll keep digging..
I found the problem commit that Image
class replaced with File
in #3285 PR
@distantnative @afbora can we revert that without too many side effects. I think we cannot launch 3.6 with this issue.
I'm not sure but I've an idea! What do you think about checking file type after immediately creating basic file?
// create the basic file and a test upload object
$file = static::factory($props);
if ($file->type() === 'image') {
$upload = new Image($props['source']);
} else {
$upload = new BaseFile($props['source']);
}
https://github.com/getkirby/kirby/blob/develop/src/Cms/FileActions.php#L182-L184
I think something in that direction. Reverting isn't a way with the refactored class structure. We need to use the right class when checking during upload.
Why was Image replaced at all? It already extends the File class and it doesn't really do any harm in my opinion to use the Image class for all files, or am I missing something?
Ah, I see. It's probably mainly because of the set of validations, right?
Because we split Image into an actual File and Image class - before that any file was treated as image which was kinda weird.
The reason for that decision was mainly based on the fact that some files can be inspected by getimagesize (mostly videos) which is super weird, but would at least mean that you could apply those checks to videos as well.
Should we then use Image for images and videos (in @afbora's check)?
Yes, I think that would be the most "compatible" way with 3.5.x. We could then maybe extend it later with new file type classes if there are additional useful checks and methods for videos or documents or whatever.
✅
Describe the bug
The minwidth property in file blueprint doesnt lead to upload permission and error message. Instead smaller files can regulary be uploaded.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
File upload is permitted
Screenshots
Kirby Version
3.6.0-rc-1