New answers tagged

0

I recently needed this myself with the twist that I wanted to provide a default (svg) image when no image was uploaded. Twig Tweak makes this possible while still allowing me to control the output via Drupal's user interface. In my case, I'm styling a comment, so I want to render the user picture, and I'd like to use the "thumbnail" image style. This is ...


0

If your html contains a style attribute e.g.it will block the resizing of an image. <img src="image.jpg" style="width:300px;height:200px;" /> Remove the style attribute to make sure resizing works. Searched a very long time for this!


0

To get the uri of remote video in node--page.html.twig try with: node.field_video.entity.field_media_oembed_video.value


0

This way should be bulletproof: use Drupal\Core\Link; use Drupal\Core\Render\Markup; $url = $node->get('field_url')->getValue(); $imageUri = $node->get('field_image')->entity->getFileUri(); $image = [ '#theme' => 'image_style', '#style_name' => 'medium', '#uri' => $imageUri, '#width' => 200, '#height' => 100 ]; $...


0

I know this is an old post but I ran into this issue on several sites with a ton of content. I ended up adding a meta tag to my html.tpl for a quick fix <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> See https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content


1

A file that comes in from a browser's Web API as a Blob is probably base64-encoded. PHP will not decode files in the POST or GET parameters. It is up to the PHP application to decode the file before saving. if (!empty($payload['blobFile'])) { $name = str_replace(' ', '_', $payload['fileName']); $file = file_save_data(base64_decode($payload['blobFile']), ...


Top 50 recent answers are included