Skip to content
Snippets Groups Projects
Commit c7c794d5 authored by Cesar Miquel's avatar Cesar Miquel Committed by Damien McKenna
Browse files

Issue #3230274 by cesarmiquel, idebr, nkraft, DamienMcKenna: Restore itok...

Issue #3230274 by cesarmiquel, idebr, nkraft, DamienMcKenna: Restore itok parameter to image URLs in Media elements.
parent a7e6ea0c
Branches
Tags
No related merge requests found
......@@ -16,6 +16,8 @@ Advanced Views RSS Feed 8.x-2.x-dev, 2022-xx-xx
#3367284 by idebr, nils.destoop, Lendude, DamienMcKenna: media:content width
and height attribute should be determined from the image style instead of the
original image.
#3230274 by cesarmiquel, idebr, nkraft, DamienMcKenna: Restore itok parameter to
image URLs in Media elements.
Advanced Views RSS Feed 8.x-2.0, 2023-06-14
......
......@@ -41,8 +41,9 @@ function views_rss_media_preprocess_item_content(&$variables) {
if ($image_style_name = $item['rendered']['#image_style']) {
$image_style = ImageStyle::load($image_style_name);
$uri = $image_style->buildUri($file->getFileUri());
$url = $image_style->buildUrl($file->getFileUri());
$element['attributes'] = [
'url' => \Drupal::service('file_url_generator')->generateAbsoluteString($uri),
'url' => $url,
'fileSize' => filesize(\Drupal::service('file_system')->realpath($uri)),
'type' => $mime_type,
];
......@@ -117,7 +118,7 @@ function views_rss_media_preprocess_item_thumbnail(&$variables) {
// Image style is defined, need to link to resized version.
if (!empty($item['rendered']['#image_style'])) {
$image_style = ImageStyle::load($item['rendered']['#image_style']);
$element['attributes']['url'] = \Drupal::service('file_url_generator')->generateAbsoluteString($image_style->buildUri($file->getFileUri()));
$element['attributes']['url'] = $image_style->buildUrl($file->getFileUri());
}
// Normal image size.
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment