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
21 votes
5 answers
24k views

Image styles return Access Denied

I'm using the Insert module to allow users to insert images with a specific image style into a page. After upgrading to Drupal 7.20, the images are not stored in the files/styles folders, and the ...
Evan Johnson's user avatar
53 votes
6 answers
37k views

How can I automatically upload images on file selection rather than pressing the upload button?

I have a custom content type to allow users to upload images. I'm trying to keep the interface as simple as possible. The content type contains a single image field. This works, but some users don'...
Patrick Kenny's user avatar
62 votes
8 answers
81k views

Rebuild images from image style

I have an image style in Drupal 7. I attached several images to a nodes and display the images based on this style. I then changed the effects on this image style but the existing images are not being ...
Justin's user avatar
  • 3,703
55 votes
17 answers
127k views

Getting the image URL from a field_image on a node

So I have this Node: object(Drupal\node\Entity\Node)[1862] protected 'values' => array (size=17) 'vid' => array (size=1) 'x-default' => string '7' (length=1) ...
Rias's user avatar
  • 723
37 votes
5 answers
87k views

Get path to theme assets in Twig template

I have a question about getting a path to an image in a Twig template. The image is not assigned to a field or something. Just a static image which is stored in "MYTHEME/image/icon/my-icon.png". In ...
Yetispapa's user avatar
  • 697
1 vote
1 answer
3k views

How can I display a picture from a field as the user picture rather than the drupal default with user-picture.tpl.php?

Because my site requires user pictures to be approved, the default Drupal user picture is not suitable. Instead, I want to show a picture from a field in each user's profile as the user's profile ...
Patrick Kenny's user avatar
16 votes
7 answers
43k views

Rendering an image field in page.html.twig with a custom image style

I'm trying to set up a slideshow that's unique to each page. The code for this needs to be in page.html.twig. I've got the slideshow mostly working, but I can only call the full image URL, not a ...
JacobTheDev's user avatar
12 votes
1 answer
15k views

How to set Media Styles in Media 7.1.2 / Media 7.2.X?

Where is the latest form of the component in the Media project family that allows styles to be defined for Media files? I see a lot of references to the idea that the Media module contains, once ...
user56reinstatemonica8's user avatar
11 votes
3 answers
31k views

How to get an image URL from a field in a twig template

I have a node that contains various fields. I am able to get the values of text fields but not an image field. Below is the relevant output of the node variable being dumped in the twig template: '...
Adeleke Akinade's user avatar
2 votes
4 answers
9k views

image style (imagecache) images are not being created

Currently i am unable to create images that get resized automaticaly according to the different image styles. This includes the default styles such as thumbnail as well as the custom created styles. ...
stefaan dutry's user avatar
18 votes
5 answers
52k views

render or print image in a drupal 7 node.tpl?

I am trying to theme a node with tpl and when i tried to print image , I cant find image path like in d6.. which function i have to call to properly output image .. I mean something like theme('')? ...
Serjas's user avatar
  • 1,357
12 votes
7 answers
18k views

image_style_url doesn't create images [closed]

I am using image_style_url to get a thumbnail of a picture I added through the administrator interface. // $foo->field_picture['und'][0]['uri'] has value public://foo.jpg image_style_url('foo-...
Bart's user avatar
  • 6,934
11 votes
4 answers
14k views

Unable to generate the derived image

Today I uploaded my site to the server, and I get errors like the following: Unable to generate the derived image located at public://styles/sponsor_image/public/TerraThermaSponsorLogo.png. Image ...
Petro Popelyshko's user avatar
10 votes
6 answers
21k views

How to find image style URL from within twig template?

I'm implementing a node template that uses an image twice; once in a 'normal' way (i.e. using the image style defined in the field's display configuration for that view mode), and the other is as a ...
artfulrobot's user avatar
  • 4,009
10 votes
3 answers
5k views

Theme Image Style for image located in module directory

Probably coming at this from too much of a Drupal 6 view point but... How do I theme an image in a given image style when that image lives in a module folder? This is driving me batty and I know I'm ...
PrairieHippo's user avatar
6 votes
1 answer
13k views

Programmatically update node image field (using URI of the image) and get URL in twig

I am trying to update a node image field programmatically. I currently loading the node like this: $node = Node::Load(1); have the URI if the image that I want to set. I have tried this but no luck: ...
harnamc's user avatar
  • 421
4 votes
1 answer
7k views

How renderable array for an image with style should look like?

I have a custom module that outputs some images. Now, I would like to render them properly. Currently, I use theme() function, kinda similarly to the way shown here1 and here1: echo theme('...
Mołot's user avatar
  • 21.9k
1 vote
4 answers
4k views

How can I reduce the file sizes of the original versions of uploaded image files?

I have a Drupal 7 site that allows users to upload pictures of themselves. While the pictures aren't using much space on the server's filesystem now, I am worried that if my membership grows ...
Patrick Kenny's user avatar
10 votes
7 answers
19k views

Failing to create thumbnail, medium and large images

When using a new installation of Drupal 7.10, I have set the directory for public uploads to sites/uploads. When I then add an image to a content instance, I get the original uploaded to sites/...
jvc26's user avatar
  • 551
10 votes
5 answers
6k views

force image style generation on save node

I've got still my problem described here Image style, reuse image in field collection item but i gave up to get a solution. A workaround which came up in my mind is to force the generation of ...
sinini's user avatar
  • 384
8 votes
1 answer
18k views

How to get Media entity image (Entity Reference Field) URL in TWIG theme

Apologies if this question has already been asked. However, in my research I found the answers have been for simple image fields which are in default install of Drupal 8. However, in order to have ...
Vikram's user avatar
  • 83
7 votes
2 answers
7k views

Why is there quality loss on my image styles?

This is the original image (610x405) This is the image after applying image style (scale and crop) to 290x190. Both image have the same aspect ration, yet there is visible quality loss on downsizing....
Pratik Bothra's user avatar
6 votes
7 answers
11k views

Image styles do not work

I am struggling to find a solution for image styles not getting generated. The original pictures get uploaded to the server but no styles or thumbnails are generated. I have checked folder ...
Dru8's user avatar
  • 61
6 votes
3 answers
2k views

Handling mobile images in responsive theme [closed]

Sorry for the open-handed nature of the question, but I don't know where else to get an answer to this. I'm deciding whether or not go full-force into a responsive Drupal 7 theme, probably the Omega ...
btotheg's user avatar
  • 171
5 votes
6 answers
8k views

How to allow users to rotate a picture upon upload?

On my site, users are able to upload images one at a time as nodes of content type Picture. The Picture content type uses the core (D7) image field. Some of my users have pictures which are taken ...
Patrick Kenny's user avatar
5 votes
5 answers
23k views

How to add a background image wallpaper to a drupal site from within the drupal admin?

How can I add a background image wallpaper to a drupal site from within the drupal admin i.e. not editing themes or PHP? I'm not adverse to PHP or themes but adding a background image wallpaper is a ...
therobyouknow's user avatar
4 votes
3 answers
4k views

Move file storage to another server

Consider this: I have one fast server with a Drupal installation but this server does not have access to a lot of disk space. I have another server that isn't quite as fast but does have access to ...
Mike's user avatar
  • 539
4 votes
1 answer
9k views

Render image field from node in page.html.twig

I make my first steps with Drupal 8. I have a site with a header image. On a specific content type "Blog" I want to replace the standard header image with a node specific header image. So in the ...
Andreas Gyr's user avatar
4 votes
2 answers
2k views

How to keep underlying file when deleting a Filefield value

I have a Content Type with a FileField (Image, in particular). When one of these values is deleted, then Drupal deletes the underlying file as well (as long as no other nodes reference the same file). ...
Greg's user avatar
  • 1,076
4 votes
1 answer
7k views

Getting a custom block image field URL in the block Twig template

I have a custom block containing a text field and an image field. I would like to render the block so that the image's URL can be defined as a data attribute of the block's wrapper div so that it can ...
cheesetriple's user avatar
2 votes
1 answer
8k views

Save image from URL to a field from a custom module

With a custom module, I'm trying to create a new node, save an image to a node's image field from URL and save the node as well. However when I'm trying to save the node, this error messages comes up ...
Bálint Deáki's user avatar
1 vote
1 answer
1k views

Filter |raw doesn't show entity media image

Using the following code for displaying content from a WYSIWYG field: content.field_body|raw I only got the text without images added in a editor as media. When I remove filter raw I see <drupal-...
master's user avatar
  • 25
0 votes
1 answer
9k views

Preprocess image: how to get parent entity?

I'm using responsive images (single img tag with srcset and sizes attributes). My content editors can manipulate the displayed size of the image with a custom field on a shared parent entity. ...
Hudri's user avatar
  • 5,473
0 votes
4 answers
2k views

I get image field upload errors with a custom node_add() form

I've exposed a node_add form and styled it for certain roles to use. The form is being displayed in panels, through an 'article' node type using the PHP text filter. Users can create new nodes with no ...
emc's user avatar
  • 863
20 votes
6 answers
28k views

How to programmatically add image from external URL using media module?

I want to programmatically add an image from an external URL and have the module store and display a local copy of the image. How can I do that? Normally, I would click the "select media" button while ...
Matthew Hui's user avatar
  • 1,368
9 votes
2 answers
3k views

Image and Media Best Practices

I am looking for suggestions on Best Practices for D8 and files / media entities. I originally added this as a answer but kiamlaluno evidently felt that it should be a new question in itself so here ...
Chris Riley's user avatar
9 votes
1 answer
5k views

Form API image preview

I've read many discussions about image preview in fapi with 'managed_file', but I can't find a conclusive answer on how to do this properly in D8. An obvious solution would be to reuse Drupal\image\...
maartend's user avatar
  • 121
8 votes
2 answers
8k views

Create styled image programmatically

I have a module that create custom PDF with multiple selected nodes and I use the below function to create the link to styled images: $file = File::load($img_id); $imagesPath[] = ImageStyle::load('...
Mistraë's user avatar
  • 392
8 votes
3 answers
3k views

Image Annotations in Drupal 7

What's the best way of creating image annotations in Drupal 7? Ideally, I would like to re-recreate something like in Concept Feedback, where you can post annotations on an image and then display ...
big_smile's user avatar
  • 2,828
7 votes
1 answer
12k views

How to change Views field settings programmatically?

I would like to change some field settings in a given view created with Views programmatically. For example, I would like to change the "Formatter" and "Image style" settings of an Image field. This ...
Sk8erPeter's user avatar
  • 1,801
6 votes
2 answers
2k views

Media 7.x-1 Library tab empty

All of the sudden my media library tab becomes empty. I check the permissions and everything seems to be fine.
cayerdis's user avatar
  • 2,240
6 votes
3 answers
2k views

How to bulk update image alt and title?

I have a content type with an image field. How do I update all my images to have the node title as the alt and title of the image? I don't want to edit hundreds of nodes... Thank you. Daniel
Daniel's user avatar
  • 115
5 votes
1 answer
2k views

How can I only show the first image of a multi-value image field in the teaser?

I have a content type with an image field that can contain an unlimited number of images. The field is used to display an image gallery in the full node view, but I also want to use the first image of ...
Mad Scientist's user avatar
5 votes
5 answers
4k views

Drag & drop files into drupal site?

Does anyone know of a module that allows to drag files from users computer into a target area in site (like in gmail or wordpress)? ideally this would work with Image and other modules to insert the ...
Moshe Eshel's user avatar
5 votes
1 answer
887 views

Delete multiple images at once from a node

I'm having an image field with option set as UNLIMITED to accept infinite images, basically deleting images in single manner is possible, but how it can be possible to delete multiple images at once ...
Hemangi Gokhale's user avatar
5 votes
2 answers
552 views

Add a gallery for every user in a block

I want to be able to add a gallery for each user. I understand how to create a content type. I considered building an image content type. I then thought I could add a view which would only display ...
Alexander's user avatar
  • 633
4 votes
1 answer
2k 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 ...
Patrick Kenny's user avatar
4 votes
3 answers
7k views

Basic Multiple Image Upload to replace standard image uploader

First question on Drupal Answers, hi everyone. Starting off with a very basic question actually: While the standard single image at a time uploader is swell and all, I've got the Galleria module ...
RedactedProfile's user avatar
3 votes
1 answer
2k views

Is it possible to automatically delete image files that have been uploaded when a node is not saved?

I'm using Drupal 7. On my site, users can add pictures via a content type, Pictures, that makes use of the core image field. If a user uploads an image file and saves the node, then if the node is ...
Patrick Kenny's user avatar
3 votes
1 answer
1k views

8.4 - Use entity browser in a module block from in same way as I would in a custom block

I am having trouble adding an image picker to a block form defined in a custom module. If I create a custom block type I can define an image field as entity_reference and in the block's form view ...
Gruffy's user avatar
  • 93

1
2 3 4 5