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
1 answer
54 views

Creating remote video media entity programmatically not generating thumbnail

Using Drupal 9.4.1, I am creating a remote video media entity programmatically and for some reason the title and thumbnail are not being created. They are created when cron runs so in my terminal when ...
user avatar
  • 407
0 votes
1 answer
22 views

Image styles - How to resize uploaded images and force an aspect ratio

I'm looking for a solution to resize uploaded images while maintaining a desired aspect ratio instead of cropping them. We can configure some preset Image styles, but it seems we can only : Resize : ...
user avatar
0 votes
0 answers
10 views

Migrate update media / node + skip_on_empty plugin

I use a custom migration to update medias from an external JSON source. Inside this migration I use a custom plugin to search in database if the media name exist. If I get a 'mid' I want to update the ...
user avatar
  • 109
0 votes
0 answers
23 views

drupal-media ckeditor tag not well rendered for remote and local video

i'm running a 9.3.16 drupal site with media and media_library modules enabled. I've three types of media entities : video, remote video and image. I can upload and display the three types of media on ...
user avatar
0 votes
0 answers
15 views

How to create a media entity via rest api

Getting a 422 Unprocessable Entity while trying to create a media entity via rest api. I've failed to find any docs regarding what params/entity type I need. This is how I usually create entities via ...
user avatar
0 votes
1 answer
22 views

How to display in a block the media used in a node?

On my Drupal 9 installation, I created nodes with Media images integrated with CKEditor. This is not an image field in the node type, but an image embedded in node content with Media and CKEditor. How ...
user avatar
0 votes
0 answers
18 views

Images styles are not created in public directory with OpenLiteSpeed server

I've moved recently my drupal 9 website from nginx webserver to openlitespeed. The website was working as expected, but now it is not. I've defined a rule when uploading a new image, it should be ...
user avatar
0 votes
1 answer
26 views

Broken Image styles don't generate

I am on Drupal 9.3 Set the Private file system path in settings.php file $settings['file_private_path'] = '../private'; Create a folder name outside the "web" folder named "private"...
user avatar
0 votes
1 answer
49 views

Generate a Media entity from a remote URL?

I want to create embeddeable "media" similar to how embedding YouTube or Vimeo videos work. When a URL is pasted in, I want to store this as a media entity (its own type) and then render it ...
user avatar
  • 26.5k
0 votes
1 answer
54 views

How do I apply the `loading="lazy"` attribute to responsive media?

On my Drupal 9 installation when I create an "image" field, Drupal automatically adds the loading="lazy" attribute. When I create a "media" field with an "Adaptive ...
user avatar
0 votes
1 answer
41 views

Media Library results filtered by user

I am working on a project that will be using 100's users and potentially thousands of users. The users will be required to upload at the very least 5 images and possibly some PDF files. Created a ...
user avatar
1 vote
1 answer
30 views

Link in URL field to Media File

Before the Update to the latest DruPal 8, we were able to link to public://foo/bar.pdf to a file which was in /sites/default/files/. No the public:// prefix does not work anymore in the URL input ...
user avatar
  • 87
0 votes
0 answers
50 views

Programmatically attach an image to a field

I am using Drupal 9.3.13 on localhost. I generate successfully a QR Code based on the .SVG format and store that image on public://. I created various field types, one of which is a field_file_svg ...
user avatar
1 vote
1 answer
30 views

How to add new fields to the 'edit media' dialog box on media embeds

I'm attempting to add a new select box to the dialog box that pops up when choosing 'edit media' on a media embed in a WYSIWYG. I'm referring to the dialog box that presents options like 'caption' and ...
user avatar
  • 5,076
2 votes
1 answer
91 views

Use a different twig media template if it is being rendered inside a WYIWYG

I have a twig template for a media entity that I wish to be able to embed into a WYIWYG. I am able to, however the entity has issues rendering when inside the ckeditor that aren't present when ...
user avatar
  • 5,076
0 votes
1 answer
73 views

Programmatically change view mode of media field

I'm attempting to change the view mode of a media field programmatically. I've created a view mode called 'modal'. I created a mytheme_preprocess_media hook and attempted to change the view mode a ...
user avatar
  • 5,076
0 votes
1 answer
29 views

Upload directory with no prefix (://) was not found for file uploads

I am not able to get file uploads of any type to work on my Drupal instance when I attempt to add media using the built in form. When I upload an image file, I get: And looking at the log messages in ...
user avatar
  • 253
1 vote
1 answer
36 views

Key based access control for private files

I'm building a site that provides paid video content, for embedding in customer's own sites. I'm successfully controlling access to the nodes that contain the video content based on purchasable user ...
user avatar
  • 195
0 votes
0 answers
45 views

How can I use the custom image as thumbnail for Youtube videos?

i want to use custom image as thumbnail for remote video (youtube) in my paragraphs , I create one field called custom image under remote video and used the below code. if ($entity->bundle() === '...
user avatar
0 votes
0 answers
24 views

Ckeditor does not show the latest image

I have a media item that is displayed in the body field with Ckeditor with the following markup. <drupal-media data-align="center" data-entity-type="media" data-entity-uuid=&...
user avatar
  • 2,697
2 votes
0 answers
76 views

Why isn't an image from the local domain shown with the explanation that, for security reasons, only images from the local domain are allowed?

I'm running Drupal Core 9.3.7, with basically the default set up. The Basic HTML editor is CKEditor. If I include an image in a page, that image is not shown when I view the page; on inspection, it is ...
user avatar
0 votes
0 answers
28 views

Looping through media item field in commerce product template

I am currently building a commerce shop. Usually, I use embed, entity browser and dropzone js, to make a product images collection available to shop administrators. This time, I used a Drupal media ...
user avatar
1 vote
0 answers
45 views

Need help regenerating images after image cache flush

TL;DR - Flushed image cache for an image style that is used in basically every blog. They are not regenerating on page load. They regenerate when i edit and save the node. Looking for ways to ...
user avatar
0 votes
1 answer
29 views

What is the token for an original image URL?

The is the token to get the url for a "large" image style: [node:field_image:large:url] What is the token that will give me the original file URL for the image? That is, not an image style ...
user avatar
0 votes
1 answer
124 views

How do I post a PDF?

I followed these steps to post a PDF file to Drupal. Enable JSON API to create at admin/config/services/jsonapi Enable the media POST resource Media /media/{media}/edit: GET, PATCH, DELETE /...
user avatar
  • 1,357
0 votes
0 answers
39 views

Display images from private files to public

Is it possible to display private files/images to the public for example with tiwg tweak? I've tried examples from here: https://www.specbee.com/blogs/twig-tweak-in-drupal-9-functions-and-filters ...
user avatar
  • 1
0 votes
1 answer
23 views

Referencing media from theme settings and display it on front page

In a custom subtheme of classy base theme, I made a theme setting for referencing an image media file. Contents of file theme-settings.php: <?php use Drupal\Core\Form\FormStateInterface; use Drupal\...
user avatar
0 votes
1 answer
46 views

image.html.twig naming sugestions

I need to customize the image.html.twig template. I have a new content type with an image field (field_tile_image). How can I overwrite the default image template only for one block? I tried different ...
user avatar
  • 101
1 vote
0 answers
49 views

How to change the CKeditor button for media library module [closed]

The Drupal 9 Media Library includes a button for CKeditor. The button depicts an image icon combined with musical notes. We plan to only use this button for video. How can I replace this button with ...
user avatar
  • 440
0 votes
0 answers
12 views

How can I enable autocompletion for media entities in Link fields? The Link field seems to "know" only nodes, but no media entities

The idea is to create an inline link on some arbitrary text typed in CK Editor. That link should target a file uploaded to a Media file entity. in basic terms - when I select "Link" and type ...
user avatar
  • 1
1 vote
0 answers
28 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 ...
user avatar
  • 181
0 votes
1 answer
34 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 ...
user avatar
  • 117
0 votes
0 answers
32 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 ...
user avatar
  • 11
1 vote
0 answers
75 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 ...
user avatar
  • 198
0 votes
0 answers
35 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/...
user avatar
  • 43
0 votes
0 answers
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 ...
user avatar
  • 21
0 votes
0 answers
13 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 ...
user avatar
1 vote
1 answer
55 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 ...
user avatar
0 votes
1 answer
36 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 ...
user avatar
1 vote
0 answers
16 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 ...
user avatar
  • 11
1 vote
1 answer
24 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' => $...
user avatar
  • 375
3 votes
1 answer
26 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 ...
user avatar
  • 31
0 votes
0 answers
29 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 ...
user avatar
0 votes
0 answers
143 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 ...
user avatar
  • 157
0 votes
1 answer
31 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 ...
user avatar
0 votes
0 answers
12 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 ...
user avatar
  • 375
1 vote
1 answer
105 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 ...
user avatar
-1 votes
1 answer
35 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 ...
user avatar
  • 11
-3 votes
1 answer
27 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 ...
user avatar
  • 43
1 vote
1 answer
55 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 ...
user avatar

1
2 3 4 5
55