Questions tagged [media]

Drupal core has some modules to handle images and other media files, for example the Image module and the Media module.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Some image styles not generating while other are

I'm seeing a strange issue where some of our image styles seem to be broken while others work fine. The broken ones are showing the typical signs of the source image existing while the image style url ...
0
votes
1answer
40 views

How do I migrate body content with [embed]*[/embed] tags?

Currently I am working on migrating a Drupal 7 site to Drupal 9. The nodes in the site has nodes with content similar to the following one. <h3><strong>WHAT WILL YOUR NEXT MEAL BE?</...
0
votes
2answers
50 views

How to render a media field as responsive image?

I'm trying to render a media field as a responsive image in a custom twig template. My naive approach looks like this: {% include 'responsive-image.html.twig' with { "sources": content....
0
votes
0answers
17 views

Field UI / image field - empty the whole field / all values

I'm using an image field with multiple images to manage a custom built gallery. With e.g. IMCE I am able to bulk upload and insert images into this field. Now I I have to periodically replace the ...
1
vote
1answer
21 views

How to get product variation media file url using jsonapi?

I'm using the following jsonapi GET request to retrieve product variations for a product: /jsonapi/commerce_product/default/0ea927c7-b62d-45c9-8bec-dc3d16215276/variations?include=field_images ...
0
votes
1answer
48 views

How to access url of Remote Video, Document and Image inside twig template?

I have a field called Media (machine name: field_media) inside of a content type. This field Media takes the media types of Remote video, Image, and Documents. I am currently trying to render this ...
0
votes
1answer
35 views

How to add captions to media library items?

Anyone know how to associate a caption to a image that gets uploaded into a media library field? I can get the name of the file to show up but I can't see how to associate a caption to the image. I ...
0
votes
0answers
26 views

How do I add a media item with a custom form? [duplicate]

I have a custom form that currently uses a managed file field and then stores the value in config. However, if there is ever an issue, the user must remove and upload a new file. I would like them ...
0
votes
2answers
56 views

Is there an easy way to get the image derivatives links?

I'm working with complex image styles, and I'd like to be able to load all the different derivatives quickly to check they're being processed correctly. But I don't see how to easily get the links. ...
1
vote
1answer
50 views

What is the token for the file download link of a media entity?

Using the linked_field module and the [paragraph:field_pbpresentation_file:entity:url] token, I get the edit link for the media entity, not the link to download the file itself. What token should I ...
0
votes
1answer
27 views

Editing media for content editor results in a 404

We have a custom role, location_editor, which is assigned to users who can only manage media and one content type. These are the role's media permissions. And if the user now tries to enter any valid ...
0
votes
0answers
19 views

Image is not showing on the product edit page after creating the product using API

I am trying to create a product with a product image on drupal using API. There was nothing given regarding uploading an image in API so I created a custom module under which i used this code to ...
0
votes
0answers
41 views

How to display images from the media library on paragraphs that belong to a body-type field

I'm only able to display text from a body field. How do I display images from the media library? This is what I tried, but it doesn't work. Thanks in advance! {% block paragraph %} {% autoescape ...
0
votes
1answer
38 views

Can't add an image extension to the field_image of the Article content type

I need to upload an image with the webp extension and add it as the main image of a content item with the "Article" content type. Since its field_image doesn't have the webp extension by ...
4
votes
1answer
220 views

How can I use core's WebP support instead of the WebP module?

According to the change record, Drupal 9.2 supports WebP for better image compression. I've been using the WebP module on my 9.1 site to serve WebP images, but it has a performance-killing bug and I ...
1
vote
0answers
30 views

Why do drupal-media elements not get rendered in Layout Builder CKEditor?

In Layout Builder, add a custom block. When editing the block in CKEditor, add an image using "Insert from Media Library" button. Exit CKEditor. Re-edit the block in CKEditor. Result: I do ...
0
votes
0answers
16 views

Image field input renders with type text instead of file

(Drupal newb - please go easy and give references that help me learn how to debug stuff in Drupal myself, thank you!) I've taken over a Drupal site with 7.80. There's a type called Event which has a ...
0
votes
0answers
43 views

How to use [node:title] token as filename for media type fields?

I have a Drupal 9 site have two modules FILE (FIELD) PATH module and token is used. So for a content type, one image field is there where in the File (Field) Path settings I have the file name as [...
0
votes
1answer
29 views

Unable to preview media items

I have a node page where, in the WYSIWYG, I have embedded about 50 media items. When I edit the node, I can see this error for some of the media items. An error occurred while trying to preview the ...
0
votes
1answer
48 views

Programmatically create a new image style

I'm creating my own module and I need to programmatically create an image style to use with a new media type. I found the core/profile/standard/config/optional/image.style.max_1300x1300.yml file whose ...
0
votes
0answers
25 views

How can I make a widget similar to the media library, just for other entities?

I want to make widgets similar to the one that is provided by media library, but just for other entities, for instance Bibliography & Citation or even just other content. Is it possible to build ...
0
votes
0answers
18 views

Use .ogg file als alternative video source using the core media module

To be able to upload video's to the media library. I have to create a media type video. When creating this type I have to choose a media source. The media source I choose is video file. This gives me ...
0
votes
1answer
47 views

How can I change the label on the "Add media" button in media field widget?

I would like to change the label on the button named "Add media" on the media field widget. For instance to write "Add image" or "Add document". How can I change it?
2
votes
3answers
173 views

How can I get a custom module's file path in a preprocess function?

I've got default images located in a custom module directory and I'd like to load them using hook_preprocess_node(). I then will pass the images to the template file. In the screenshot, I'm loading an ...
0
votes
0answers
39 views

add an image to an article

I try to add an image in articles but the content filter won't save? WHen you add content, article there is the content filters, like full html, or basic. Each has the icons where you can add images. ...
2
votes
0answers
31 views

What is the equivalent of hook_image_styles_alter()?

I would like to allow uploading of SVG images to all the existing image fields with image effect. However, I wouldn't like the image styles to be applied to SVG images, as it is mostly designed for ...
0
votes
0answers
23 views

using uploaded images for different image styles with Media entities

Using Media entities, is there a way for some of the media entities to use an uploaded image for a different image style, as opposed to automatically generated or manually cropped? So for example: ...
2
votes
1answer
66 views

How I can insert some help text on the ckeditor media embed "Create embed" tab?

How I can insert some help text on the ckeditor media embed "Create embed" tab? Oddly, I can't even find those words together in code. I have a user confused about its use, so I want to ...
1
vote
1answer
56 views

How do I hide static media file URLs?

I have developed a website in Drupal 7. Right now I have a requirement: A page should display a PDF file (already generated). Only authenticated users should have access to view or download this file, ...
0
votes
0answers
24 views

How to embed image field url in API response?

I have a content type that has a title, body, link, and image field. Then in my php file I have the following: $articles = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties(['...
1
vote
1answer
52 views

How to create a view of Media images that do not have any Alt Text

For accessibility purposes I want to create a view of Media images that do not have any Alt Text. Creating a view of Media images and also displaying Alt Text is not difficult, as explained is this d....
0
votes
1answer
24 views

Filter content type by media type

I have a content type that has a media field that can contain audio, video or image, I created a view and I want to filter the view depending on the media type is that possible using Drupal views or ...
0
votes
0answers
21 views

Media library does not display grid properly when accessed as non-admin user

Using Drupal core 9.1.7 Theme: Eclipse multipurpose theme Enable Media and Media library modules Add a field to a content type as Media (Entity reference) Setup form display to show this field as ...
0
votes
0answers
17 views

I can't alter the 'entity.media.route'

I want my drupal user to see the media edit form using the frontend-theme, not the admin-theme. In my RouteSubscriber I use if ($route = $collection->get('entity.media.edit_form')) { $route->...
0
votes
0answers
28 views

How to display files by language

Is there a preeve of concept way to upload or display files translated in different languages. So for example if there is a site with German, English and Spanish. How to upload and display different ...
-4
votes
1answer
29 views

I'm using the media video module, how do I upload alternative webm and mp4 versions?

Server hosted video. Using the core video field. I'd like to put up a webm version, but also a mp4 version encoded for safari. Create a video block with 2 source items <video> <source src=&...
0
votes
0answers
23 views

Responsive image folder creation inconsistencies

Just implementing responsive images and find that I have one content type (slider) that the folder structure does not get created as expected in the styles folder. Output is: slider_mobile1 | ---...
-2
votes
1answer
119 views

How to add and associate Paragraphs to Media Library Images Programmatically

Good day everyone, Our client wants to have this feature where he can upload/reuse multiple images for an article content type. This can be achieved using a Media Library, where I find it tricky is ...
0
votes
0answers
109 views

How to get the URL of remote video inserted by media field in block or paragraph twig?

How to get the URL of remote video inserted by media field in block or paragraph twig? I am using the paragraphs module to create video galleries from youtube videos. When I use {{ content....
0
votes
0answers
31 views

How to decode base64 image using pre save hook?

I am uploading image using jsonapi. But here the data is base64 format (As per requirement). Uploading to media entity. So I need to write a hook media entity pre save so that file uploaded should be ...
0
votes
1answer
40 views

I'm attempting to render responsive images and control art direction. Could somebody see whyI can't get breakpoints.yml to be respected?

I'm creating a title/ hero-image section that consists of two 50/50 columns at desktop but then stacks at about tablet (e.g. 1024px) I’m using a custom twig template for this content type. I want ...
1
vote
1answer
21 views

How can I alter the form to add a new validation handler?

I'm on Drupal 8. I have created a new media bundle (permissions_json) which can be created from /media/add/permissions_json, where administrator user can upload specifically formatted JSON files, and ...
0
votes
1answer
279 views

How do I configure Content Security Policy for base64 images?

I'm using the Content Security Policy module and I placed restrictions on img-src. Set to Self. Additional sources: https://www.google-analytics.com https://ssl.gstatic.com https://www.gstatic.com ...
0
votes
0answers
16 views

Derivative images are generated in Private filesystem but the editor shows a non existent public folder path

Im saving my images into a private filesystem. The derivatives are also generated in the same private filesystem. When the images are uploaded, the thumbnails are displayed but after the node is saved ...
2
votes
2answers
271 views

How to find the url of a media library image field in a preprocess function?

I have a preprocess function that I am using to grab one of 3 profile images. Basically we're replacing a couple stand-alone image fields with a media library reference field. The goal is to display ...
0
votes
0answers
25 views

Manage media per user without using the Media Manager widget

In Drupal 9, I have users loading audios into their profile. When logged in, users should only see their private audio media in the media manager. This works well with a contextual filter, as long as ...
0
votes
0answers
20 views

How to select the user desired crop in the "Manage Display" section of a paragraph type for an image field?

I'm currently using ImageWidget crop to give some aspect ratios for users to pick when editing content (1:1, 1:2, 2:1, 2:3, 16:9), that is properly set up in the "Manage Form Display" ...
0
votes
0answers
27 views

Media 'external video' requests iframe over http instead of https, leading to mixed content errors and blocked video

I have a drupal 9 site where I use the media library. I've created a media type with source "External video", allowing youtube videos. As far as I can see this uses oEmbed. I've added a ...
0
votes
0answers
62 views

How to make a form alter for uploads via the media library modal

By default the 'name' basefield is hidden on media entity forms and a name is automatically generated from the file name. The media name is displayed and is searchable in the media library. This ...
0
votes
1answer
29 views

Twig: Display media library reference user image at particular resolution with alt tag (on /user/1231 page)

On our user page (/user/12345) we want to change the profile image field to be a media library reference field instead. I've created for the user object a new field called field_profile_image that is ...

1
2 3 4 5
55