Install
Works with Drupal: ^9.3Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Full rework of functionality how images and videos are rendered by using custom render element cloudinary_image and cloudinary_video.
New form element cloudinary_media_library is now available to integrate cloudinary into forms with maximum performance.
Each render/form element has example usage in their definition. e.g. cloudinary_image.
$build['image'] = [
'#type' => 'cloudinary_image',
'#public_id' => 'cld-sample',
'#alt' => t('Sample image'),
'#raw_transformation' => 'f_auto/q_auto/c_fill,w_400',
'#attributes' => ['class' => ['demo-image']],
];
Breakpoints and default image transformation will be applied automatically unless you mention to not use them.
Here is example of form element:
$form['image'] = [
'#type' => 'cloudinary_media_library',
'#resource_type' => 'image',
'#preview' => TRUE,
'#title' => $this->t('Image'),
'#description' => $this->t('Choose an image from cloudinary media library.'),
];
The value will be stored in specific format: cloudinary:<resource_type>:<delivery_type>:<public_id>
New service available cloudinary_media_library_widget.asset_generator to render asset by using value from the form element.
The module provides an example form /admin/config/media/cloudinary/example with form elements for overview.