Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Proposed resolution
- Image without a specific transformation should use default image transformations settings from the config form
- Image with a specific transformation should use the specific transformation defined by used in the media library instead of the default image transformations
Remaining tasks
- Extend Asset model to collect derived information during media creation.
- raw_transformation only matters
- Create a new field to the cloudinary image media type
- Custom transformation (field_cloudinary_transformation, text plain long, optional, hidden)
- When creating media in CloudinaryMedia class, store raw_transformation if any in the new field.
- Update CloudinaryMedia::find() to take into account raw_transformation to create unique media entities but with the same file.
- Update CloudinaryMedia::createFile() to check if there is already existing file by the uri
- If so return the loaded file.
- Create a custom formatter
Cloudinary Image
based on the
ImageFormatterBase, no settings available- Only applicable for cloudinary image media type. Use isApplicable() method.
- Provide output similar to ImageFormatter::viewElements()
- Create a new service to generate file uri based on the media entity. You can get a media entity from the $item. e.g.
$media = $item->getEntity();
- Append custom transformations from field_cloudinary_transformation to the uri if any
- Append default transformations from the config form to the uri if there are no custom one available
- Example uri
cloudinary://c_scale,q_auto,w_200/samples/animals/three-dogs.jpg
- Put a custom uri in $item variable. It will be automatically picked up by
template_preprocess_image_formatter()
e.g.$item->uri = 'custom uri goes here';
- Export configs and out in the config/install of the module
Issue fork cloudinary-3283530
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
sdstyles CreditAttribution: sdstyles as a volunteer and at Dropsolid commentedComment #3
nginex CreditAttribution: nginex at Dropsolid for Dropsolid commentedComment #4
nginex CreditAttribution: nginex at Dropsolid for Dropsolid commentedComment #6
sdstyles CreditAttribution: sdstyles as a volunteer and at Dropsolid commentedComment #8
nginex CreditAttribution: nginex at Dropsolid for Dropsolid commentedI've provided some fixes and improvements.