As the title says: I think one would expect, that when the image is deleted, its cropped version also gets removed. But that does not seem to happen imo.
A hook like this would be required i think (this only works if your cropped images have a specific template):
'hooks' => [ 'file.delete:before' => function ($file) { if ($file->intendedTemplate()=='cover') { $file->croppedImage()->delete(); } } ]
this could also work (not tested):
'hooks' => [ 'file.delete:before' => function ($file) { if ($file->croppedImage()) { $file->croppedImage()->delete(); } } ]
As the title says: I think one would expect, that when the image is deleted, its cropped version also gets removed. But that does not seem to happen imo.
A hook like this would be required i think (this only works if your cropped images have a specific template):
'hooks' => [ 'file.delete:before' => function ($file) { if ($file->intendedTemplate()=='cover') { $file->croppedImage()->delete(); } } ]
this could also work (not tested):
'hooks' => [ 'file.delete:before' => function ($file) { if ($file->croppedImage()) { $file->croppedImage()->delete(); } } ]