You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because conversions can be collection specific, letting the user choose which collection an uploaded image is added to could cause issues as it will determine which image conversions are created/available.
e.g. let's say a user adds a 'profile picture' image to a user model, in Nova. The default collection might be set to "avatars", and "avatars" might have a conversion that creates a 300x300px square crop of the profile picture which might be displayed in a user directory on the frontend. But if the user who adds the image changes the collection to something other than "avatars", then this 300x300px square crop will now not be created.
A solution to this could be that there is a new option on MediaHubField... I'm not sure on the naming but it could be something like ->enforceDefaultCollection() or ->disableCollectionSelection(), and if this is present the select input that allows changing collections could be hidden.
I'd be very happy to submit a PR in line with the above, but I wanted to share my thoughts first in case there's something I'm missing or if anyone else has ideas.
The text was updated successfully, but these errors were encountered:
In addition to the above, the context menu option on image Move to collection should be rejected if either source or destination collection have custom conversions.
It is what happened to me today: Someone uploaded some images in the wrong collection, then realized the mistake and moved them to the correct one, and broke the page. It took me some time to figure out what was wrong because everything was seemingly fine 🤦
As for how it should be implemented in code, my suggestion is a second parameter for defaultCollection named allowCollectionSelection with default value true -- that is to keep backward compatibility, arguably I'd say that default value should be false:
Because conversions can be collection specific, letting the user choose which collection an uploaded image is added to could cause issues as it will determine which image conversions are created/available.
e.g. let's say a user adds a 'profile picture' image to a user model, in Nova. The default collection might be set to "avatars", and "avatars" might have a conversion that creates a 300x300px square crop of the profile picture which might be displayed in a user directory on the frontend. But if the user who adds the image changes the collection to something other than "avatars", then this 300x300px square crop will now not be created.
A solution to this could be that there is a new option on MediaHubField... I'm not sure on the naming but it could be something like
->enforceDefaultCollection()
or->disableCollectionSelection()
, and if this is present the select input that allows changing collections could be hidden.I'd be very happy to submit a PR in line with the above, but I wanted to share my thoughts first in case there's something I'm missing or if anyone else has ideas.
The text was updated successfully, but these errors were encountered: