Image reszize not happening with Kirby 4

So i think because im turning images and videos into virtual pages, by setting a template via a hook in the config on upload, but this happens after the file has been created. It is not respecting the image width set in the file blue print. I know the autorezie plugin works still but is now archived.

How can i do this with the native resziing on uploade?

my config looks like htis

'hooks' => [

'file.create:after' => function ($file) {
    if ($file->parent()->template() == 'album') {

        if ($file->type() == 'video') {
            $file->update([
                'template'    => 'video'
            ]);
        } elseif ($file->type() == 'image') {

            if (!$file->template() == 'poster') {
                $file->update([
                    'template'    => 'shot'
                ]);
            }
        }
    }
}

],

Right, if you assign a template after the file has already been created, there is no way Kirby can respect the accept or create options in your file blueprints.

If there is no way to assign those templates at upload, e.g., through different files sections, then I’d reuse the code from the autoresize plugin: kirby-autoresize/index.php at master · medienbaecker/kirby-autoresize · GitHub (adapt the parts as needed, for example, read info from file blueprints instead of from options)