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
1
vote
0answers
15 views

How to make media description show on form view when used as entity reference

Drupal 9... I have a content type of "Resource" which uses a field "download" which references the media type "document", but when I upload a file to the field, it gives ...
0
votes
1answer
20 views

Media migration results in numerous unexpected file usage records (CSV source): How to do this correctly?

I'm migrating lots of records from a non-Drupal site into Drupal 9. The records have file 'attachments,' and I want these to be media in the Drupal site. I have all the files already on the server ...
0
votes
0answers
22 views

Image compression problem

I keep on running into an issue with image compression on Drupal. I have a set of good quality, clear images, that I'm resizing down to 100px by 100px in CSS. When I resize, the quality worsens and ...
1
vote
0answers
20 views

Restrict a Media field to allow selecting only a certain file extension in an existing Media Type

Is there a way to restrict a Media field using an existing Media Type (File) in a Content Type to permit only a certain file extension in that instance? In particular, I need a subset of the permitted ...
0
votes
0answers
28 views

Apply image style on asset image

I have a static image in my theme folder. Is it possible to apply an image_style to it ? When I apply the image_style, I have this url that's generated : /sites/default/files/styles/card_product/...
0
votes
0answers
11 views

How do I get the path for an image referenced in an entity field? [duplicate]

I'm using <img src="{{ node.field_listing_location.0.entity.field_listing_location_image.entity.uri.0.value }}"> to get the path of an image referenced from a taxonomy field. What I ...
0
votes
0answers
11 views

Rewrite media field (PDF) in views

In Drupal 9 i use a media field (field_pdf) in views to display PDFs. As formatter i use thumbnail. How can i rewrite this field to open that PDF in a new window on click? My different settings are do ...
1
vote
1answer
51 views

How do I share Google photos? [closed]

I would like to have all shared albums of a certain google account automatically into a Drupal website. I was able to establish a connection with 'Google_photos_api' and show all shared albums on site ...
0
votes
1answer
26 views

Content type field to include both media entities and links

I'm new to Drupal and I'm creating a new content type. I know there's two separate fields for media and links, but is there a field that include both? For example, the field is called "News ...
1
vote
0answers
15 views

Impossible to access files in /drupal/sites and /drupal/themes after restoring the installation

I restored the files of the Drupal installation, but I'm facing an issue: All the files in /drupal/sites and /drupal/themes are not accessible. I got only 404 errors when trying to load those files. I ...
1
vote
1answer
18 views

Reference private file?

I'm making migration plugin which I'm using in first migration and it is creating private file like this: if ($final_destination) { // Create a file entity. $file = File::create([ 'uri' => $...
3
votes
1answer
25 views

Derive all image styles when user uploading

I have several image styles defined but only thumbnail and medium styles(images) can be derived from the original image. I know those two styles are set in the "manage field" of image and my ...
0
votes
0answers
23 views

Resizing the image on upload doesn't delete exif data

When I set the max resolution of an image field's max resolution, it said that the Exif data would be removed if the image uploaded gets resized, which is exactly what I need. But after I saved the ...
0
votes
0answers
22 views

Getting validation error webp image upload

I have added a image field to my "Blog" content type. In image field settings 'Allowed file extensions' section include webp format. When I upload webp format image gerring below validation ...
0
votes
1answer
11 views

Media Library: How can I pre-fill the caption when an image is inserted into a text area?

If I use Media Library to insert an image into a text area, the image's caption is empty and hidden. Instead I want the caption displayed by default, pre-filled with text in the format: [Image entity ...
0
votes
0answers
11 views

Disable form element depending on media image dimensions

I have paragraph that contains one media image field and one checkbox field. What I need is to disable that checkbox if selected image media is less then X pixels wide. So it should work when ...
1
vote
1answer
28 views

Is there a way to pull the 'description' metadata from Media's Remote Videos?

We have a Drupal 9 site that is using Media's Remote Video for YouTube videos. We need to pull the YouTube video's description but I do not see any way to accomplish this. The end result will be to ...
0
votes
1answer
33 views

Is it possible to set up Amazon advertising with the Media module?

I have a Drupal 9 site with the Media module enabled. I have subscribed to the Amazon partner program. Is there a solution to display Amazon iframe in Drupal? I am thinking of the Media module. Many ...
-3
votes
1answer
18 views

Search and pagination in media popup don't work properly [closed]

In the /admin/content/media page, I have more than one button for the pagination. The search is working properly. When I edit a media on some node, in the popup, I only have one button in the ...
1
vote
1answer
34 views

How can I let users select existing media entities in a webform?

I am a beginner in drupal and I am creating a course form I would like you to help me with a field in the webform. I need to add a field where users can add an image and documents but from the files ...
0
votes
0answers
25 views

How can we directly display/download attached document on Media path

I am trying to directly display/download the attached file when the Media link is reached. Main reason behind this is to avoid providing file path directly. For example: if a user is visiting www....
0
votes
1answer
29 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
71 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
65 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
34 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
2answers
263 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 ...
1
vote
1answer
84 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
27 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
86 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. ...
0
votes
1answer
94 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
36 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
1answer
47 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 ...
3
votes
1answer
456 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
35 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
80 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
39 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 ...
-1
votes
1answer
71 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
26 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
1answer
90 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
467 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 ...
2
votes
0answers
35 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 ...
2
votes
1answer
75 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 ...
0
votes
1answer
88 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
28 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
71 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
31 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
22 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 ...

1
2 3 4 5
55