Questions tagged [media]
Drupal core has some modules to handle media files, such as the Image module (Drupal 7) and the Media module (Drupal 8). Other modules handling media are third-party modules.
2,623
questions
0
votes
0answers
11 views
How to get the node title which is related to file in File usage view?
I am just trying to list out the nodes which are linked to files in the File Usage view. That will show up in this URL: /admin/structure/views/view/files/edit/page_2. In this view I tried to add ...
0
votes
0answers
24 views
File migration with local path
I would like to create a file migration (example) that uses a local path to an image that I store inside a folder.
If I try to enter the path to the image I get 'not a valid URL'.
2
votes
1answer
28 views
How to get the media that owns a file?
I have a file and I know there is a media that references it. How can I get this media?
In the opposite direction, knowing the media id, I can get the file:
$media = Media::load($mid);
$fid = $media-...
1
vote
0answers
39 views
Entity browser or Media Library for PDF uploads?
Client has a custom Content Type for for downloadable PDF document detail pages, which contains an entity reference to the File media type.
They want Full and Teaser view modes to display a thumbnail ...
0
votes
1answer
17 views
Load Media File in Webform Mail Handler
I want to use a single webform to send download links with specific media files to visitors that fill out that form. For example on an URL like this:
https://example.com/downloads?media=1234
The ...
0
votes
0answers
20 views
Add the presentation role to an image
I have an events page and I don't want screen readers to pay attention to the image links as each event already has a link associated with it. Having 2 links read out seems like overkill.
In my ...
0
votes
0answers
15 views
Media field image preview back instead of close
Drupal 8.x
using: Media library & Focal Point module.
I have a node type with a media field. When you upload an image in this field you can set the image information (functionality of the media ...
0
votes
0answers
5 views
How do I save a file's path in a view's plugin module scenario?
I'm building / improving an existing custom module that initially allows a user to select a CKeditor textarea as a Header for any view, where every single view can all have different images.
My goal ...
0
votes
0answers
18 views
How to choose content field shown in View using URL parameter?
I have contentType Screenshot which has 6 Image fields shot1..6.
Then I have a view screenshots_1 which shows shot1 in a grid.
I need to have 6 paths, e.g. /screenshot_1..6 each pointing to same view ...
1
vote
0answers
12 views
How to add an alias filter to the media view?
I have a path alias for my media content provided by pathauto. The media view at 'admin/content/media' shows all the content. I am able to add filter for the media entity name, type, language and ...
0
votes
1answer
15 views
Image Upload Issues Same Image Different File Name Always Receive This Error
We are currently working on fine tuning and updating the dev backend of our CMS we're rolling out for a new site.
I was familiarizing myself with the new system and uploaded some images in error.
I ...
0
votes
0answers
11 views
Storage API + Services 3: How to work together?
I am trying to set up a site that will be storing a large amount of images. I am using Storage API module for that and It is working fine through web.
Now I need a REST Service to upload images.
I am ...
0
votes
0answers
38 views
Problem with inline images after migration
We recently migrated from D7 to D8 (8.7.6). The migration went OK with the exception of nodes with inline images in the body fields (see the attached screen shot). The images were created in D7 with ...
0
votes
1answer
41 views
Image Style Clarification
Can I get some clarification as to why images aren't being generated for a certain image style in a view?
Here's my setup; I have an Article content type which allows for a main image to be uploaded. ...
0
votes
0answers
10 views
Media field format 'rendered entity' for video and 'thumbnail' for image (with image style)
I have a custom block type (call to action) where the editor can insert an image or video. In the 'manage display' of the field_media I can set the format to Rendered entity. Both the image or video ...
0
votes
0answers
18 views
YouTube media remote video - thumbnails in wrong aspect ratio have letterbox/black bars [duplicate]
I'm using the media module in D8 (core 8.7.7)
I can add YouTube videos, however although the videos themselves (and the thumbnails on youtube.com) are widescreen, Drupal is saving 480x360 4:3 images ...
0
votes
0answers
32 views
Unable to alter OEmbed remote video providers
I'm trying to add a remote video provider for OEmbed.
I'm using the hook_media_source_info_alter to change the OEmbedDeriver class like this:
use .../CustomOEmbedDeriver;
/**
* Implements ...
0
votes
1answer
75 views
Custom remote video thumbnail
I'm using the media entity from Drupal core together with the media library, to handle media on my site.
I have Remote Video and Image with crop media types. I'm using the crop and image_widget_crop ...
0
votes
0answers
21 views
Can't edit media Image from within node edit
I'm using Media and the Media Library (yes I know this is experimental). And all of the sudden I'm not able to edit my added image when I'm editing a node. In an earlier stage of the website I was ...
0
votes
1answer
23 views
Entity:media doesn't exist error when searching for url in “add link” in wysiwyg
When adding a link into a rich text field (wysiwyg) (see images bellow) and searching for a keyword the throbber icon keeps spinning and that's it.
I looked at the error logs and found the following, ...
2
votes
2answers
283 views
How can I render a responsive image style from an image in the theme directory?
I am working on template views-view-fields--myview.html.twig. But I do
not think it matters what template you are working with for this to
work.
I found this Twig that can add Drupal responsive ...
0
votes
0answers
15 views
Media field permissions
I have a certain use case. I have an entity that has a "media" reference field. I want users to be able to add/edit/delete media entities without giving them Edit any media or Delete any media ...
0
votes
1answer
34 views
How can I load all Media of a certain type?
I am trying to load all media items of a certain type but I can't find how to.
Is there a way to set a filtering type on something like
$media = Media::loadMultiple();
Or do you have to load all ...
0
votes
1answer
36 views
How can I programmatically create a media object and a new file and associate the file with the media object?
I am trying to programmatically create a media object and a file, and then associate the file with the media object. The first part works--I can successfully create the media object and file. But ...
0
votes
0answers
28 views
Programmatically update remote video thumbnail
Scenario: YouTube video was previously unlisted, so thumbnail not retrieved and now needs to be, or chosen thumbnail has been changed and needs updating.
There are a couple of core issues open on ...
1
vote
0answers
31 views
Define a default image when using image as base field in custom entity
I defined a custom entity type with an image base field. Now I want to have a default image which seems to be quite tricky: when I define a default image on a field api field and export the configs I ...
0
votes
0answers
18 views
CKEditor/Media Gallery Using Absolute URL for images, how to update?
After entering 100's of hours worth of content we noticed that the images entered through the media gallery plugin contain absolute paths, not relative. This means they breaking when we switch domains....
0
votes
0answers
21 views
View to display content type and media type
Say I have 1 content type and 2 media types users can create
Content type: Post
Media Type: Picture
Media type: Movie
How can I create a view that pulls all 3? As far as I can see you can only create ...
0
votes
0answers
32 views
Why are image styles only being generated during a cron run?
I've got a weird thing going where image styles are not being generated after uploading images (as media entities)
Image styles are generated during a cron run.
Is there a setting for this that I ...
0
votes
1answer
34 views
Performance for file serving and storage [closed]
I intend to allow users to upload images to my website, but I'm concerned that Drupal's default handling of files might not be cut out for storing and serving potentially thousands of files without ...
0
votes
1answer
27 views
Update the actual file associated with a file entity while keeping the fid?
Media module provides a generic.png file that it copies into /sites/default/media-icons/generic. That file is used on my site ~300 times, but I'd like to replace it with another PNG. Is it possible to ...
1
vote
1answer
868 views
Programmatically create media file
I'm trying to programmatically create a media file. Here's what I got so far:
$file_data = file_get_contents('http://www.africau.edu/images/default/sample.pdf');
$file = file_save_data($file_data, '...
0
votes
1answer
20 views
Creating an image upload input field
I'm creating a image upload input field in blockForm which will output to Twig later. But got stuck due to some stuff.
public function blockForm($form, FormStateInterface $form_state){
$form['...
1
vote
1answer
26 views
How can I export Image Crop configuration with an Image Style for custom module?
I have a custom module I'm re-using on other projects and I want to include an image style with an image crop configuration.
Under the configuration menu, I export a single crop item:
langcode: en
...
0
votes
2answers
103 views
How to attach media item created during migration to media field in node
I am migrating content from Drupal 7 to Drupal 8.
There is an audio field that I am currently moving to media via a custom process during migration.
When I get the id of the new media created I can't ...
-2
votes
2answers
53 views
How to get all the entity details which are using specific media?
For example: I have a image "sample.jpg" (In media library) and I used this image in multiple custom blocks of different block types.
Now I need an information of all the custom blocks which are ...
0
votes
1answer
34 views
Unset widget tab from media browser programmatically
Need to unset a widget tab from media browser based on the condition of media type supported by the field.
Media types: Image and Video.
For example, There is a field which references image media ...
0
votes
2answers
34 views
Can I store media files in the private directory?
The normal behavior, described also in Give access to private files to certain role? seem to be the following.
Once configured, files stored in the private directory are inaccessible via a direct ...
1
vote
0answers
21 views
Caption field with default value inside CKEditor
I activated the caption filter under Text format configuration to add description to media inserted via CKEditor
Is there a possibility to add a default value to this caption field whenever I add a ...
0
votes
0answers
12 views
Solr Indexing media fields
I have a bespoke media type that I'd like to index with solr. If I add a new field to an existing Media Type, I can add that field to the solr search using the interface found at admin/config/search/...
0
votes
1answer
134 views
'image_style' entity with ID 'media_library' already exists
Recently updated Drupal to 8.7.1 and I am seeing the following error when running database update:
www-data@php.container:/var/www/html/web $ drush updb -y
The following updates are pending:
...
0
votes
1answer
68 views
Media images link to their own image
I have inherited a site which had no image management. Instead each image field required you to upload an image instead of reuse an existing one.
I enabled Media Browser and updated to 8.7.
I am also ...
0
votes
0answers
17 views
Setting default upload paths for media
I really want to have an organised files folder in my d8 project.
I have two main media fields:
field_banner AND field_image
They appear in all my content types.
I would like that all the the media ...
1
vote
1answer
137 views
How to render image uploaded from a configuration form
I'm working on a custom module, that contains a block and I'm currently having an issue to render an image that is being uploaded through a form at the configuration of the block.
I'm getting this ...
1
vote
1answer
52 views
How to change image style using hook_views_pre_render()
I am trying to adapt the following Drupal 7 code to Drupal 8, in order to set a different image style to every image in a view:
// Assigns a random style name to each image
function <MODULE_NAME&...
0
votes
0answers
22 views
How to create product from image
I'm quite desperate right now and pretty newbie with Drupal. Anyhow, I wan't to develop my WordPress site and change this current system to Drupal. So now i'm able to set user specified galleries and ...
0
votes
1answer
30 views
Why cannot I get the path of a video? [closed]
I can't manage to get the video link of a media, I can achieve this with a picture but with videos it doesn't work.
This is the code I am using.
function slider_get_uri_by_media($media, $style = '...
0
votes
0answers
98 views
Entity with custom field, how to get these field in template?
I have created a Slider entity with the drupal console, with the website interface I create some fields to this entity (field_image, field_title, field_subtitle), but I can't manage to get these ...
0
votes
2answers
24 views
Should I share the same image style as much as possible or create different styles for each size?
I have an image field displayed in slightly different sizes.
Let's say :
100px X 100px as a view field format
120px X 120px as another view field format
150px X 150px as a node view format
My ...
0
votes
0answers
21 views
Alternative to hook_node_access for Media entities (Drupal 8.6)
It seems that hook_node_access does not fire for Media entities. Is there an alternative hook, or some way of forcing Media to use hook_node_access?