As a developer, I want to be able to create variant of files with different extensions.
Acceptance criteria
[x] File URL of variants can still be resolved back to their parent file regardless of whether they have a different extension. (View FileIDParser)
[x] You can still have file with the same name and a different extension and avoid collision.
[x] Normal file operation like session grant, deletion, move, publication or archival apply to variant with different extensions as well.
[x] There's an API for creating variant with alternative extensions.
[x] Variants with different extensions can be created for regular files as well as image.
[x] All Image manipulation functions work for variants with alternative extensions if they map to an image format.
[x] All Image manipulation functions can be chained when applied to an image variant with a different extensions
Follow up task
We've decided te spin off the follow AC as it's own card:
Variants of Variants are handled in a sensible manner and avoid needless duplication.
This is meant to illustrate what "Variant of Variant" means. Note that those image conversion methods won't exist right away.
$JpegImage.Png().Jpeg() doesn't throw an error or create a duplicate of the original image.
$JpegImage.Png().WebP() doesn't throw an error, doesn't use an intermediary step and creates the same file has calling $JpegImage.WebP().
$JpegImage.FitMax(100,100).WebP() results in exactly the same file as $JpegImage.WebP().FitMax(100,100)
Notes
There's a proof of concept that implements all of these concepts.
There's a low level manipulate API for creating variant with alternative extensions (something similar to manipulateImage)
What happens when you upload image1.jpg, which has a webp variant, and then you upload a separate image1.webp? When you try to download https://example.com/assets/image1.webp which of the files do you get? Or does the existence of image1.jpg stop you from uploading image1.webp?
The URL for the variant webp is not just assets/image1.webp so there should be no conflict, but this should be validated.
Excluded
Generic ToImage API that would attempt to create Thumbnails for any file type.
As a developer, I want to be able to create variant of files with different extensions.
Acceptance criteria
Follow up task
We've decided te spin off the follow AC as it's own card:
This is meant to illustrate what "Variant of Variant" means. Note that those image conversion methods won't exist right away.
$JpegImage.Png().Jpeg()
doesn't throw an error or create a duplicate of the original image.$JpegImage.Png().WebP()
doesn't throw an error, doesn't use an intermediary step and creates the same file has calling$JpegImage.WebP()
.$JpegImage.FitMax(100,100).WebP()
results in exactly the same file as$JpegImage.WebP().FitMax(100,100)
Notes
manipulate
API for creating variant with alternative extensions (something similar tomanipulateImage
)image1.jpg
, which has a webp variant, and then you upload a separateimage1.webp
? When you try to downloadhttps://example.com/assets/image1.webp
which of the files do you get? Or does the existence ofimage1.jpg
stop you from uploadingimage1.webp
?assets/image1.webp
so there should be no conflict, but this should be validated.Excluded
ToImage
API that would attempt to create Thumbnails for any file type.PRs