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
18 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
18 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
39 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
32 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
113 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
26 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
20 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
23 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
46 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
17 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
25 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
102 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
35 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
30 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: ...
0
votes
0answers
5 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
39 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
22 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
42 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
22 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
20 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
15 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
26 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
25 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
87 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
52 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
18 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
34 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
154 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
15 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 ...
1
vote
2answers
110 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
24 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
16 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
23 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
46 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
22 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 ...
0
votes
1answer
24 views

How to display a field when a media is uploaded to the media library field?

I have block settings form where I have a media library field. public function blockForm($form, FormStateInterface $form_state) { $form = parent::blockForm($form, $form_state); $user_input = $...
0
votes
0answers
7 views

overriding core asset ckeditor js to remove ckeditor media edit button

When embeding a media in ckeditor, using the media libray, an edit button is added. Since the editing does not allow to modify custom fields , i would like to remove or hide that edit button. https://...
0
votes
0answers
9 views

table media doesn't exist when accessing /admin/modules as /admin/content/media pages

When I try to visit /admin/modules/uninstall, or even /admin/media, the browser shows the following error: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: ...
1
vote
1answer
131 views

Media library widget: Table instead of grid?

Background I have a multiple-value entity reference field with target type = media. It is used for "document" media, so mostly pdf files. I am using the "Media library" widget ...
0
votes
1answer
42 views

Token does not return full dynamic path to Media Image URL

I'm having trouble configuring Metatag for Open Graph and Twitter Card images. I'm using Drupal 8.9 core Media Image reference field as the source. [node:field_hero_image] (Entity reference field) ...
0
votes
0answers
28 views

plupload upload fails with 500 Error code: 104, message: “Failed to open temporary directory.”

I installed "drupal/plupload": "1.x-dev@dev", "drupal/plupload_widget": "^1.0", "moxiecode/plupload": "^3.1" and configured a upload form ...
0
votes
1answer
73 views

How to create Media entity and attach to user field

I'm trying to import user profile pictures from Drupal 7 to Drupal 8. So far I've managed to upload the picture from the url and save it to the file system, create Media entity and use the user id as ...
0
votes
0answers
30 views

How to show media only to owners?

In order to allow users to add a remote video from Youtube, I am using the media type in a custom content type. When users create a node of that content type, and add a media, they get a list that ...
0
votes
1answer
41 views

Where are the field formatter settings?

When I'm managing a display for an entity and select a field formatter, some formatters have options available (see screenshot 1). However, when I use that same field formatter in Views, there's no ...
0
votes
1answer
75 views

How do I get the public file URI for a media file from jsonapi?

I have an audio file that is stored as Media of type Audio. Now I want to get the link to that file that is usually displayed to site users via jsonapi. For example, when the media entity is rendered, ...

1
2 3 4 5
55