New answers tagged

0

As @clive noted in the comments, all that is needed is to replace the file itself. We were having some other server issues that were causing the change not to show up. You may need to flush your image styles in order for those to pick up the new image, though.


0

You can create a relationship to the media from the fields. In advanced add a relationship to the two media fields.


1

There is a setting to flush the image style at admin/config/media/image-styles: Or you can use drush: drush image-flush --all (flush all styles) drush image-flush thumbnail (flush thumbnail style)


2

If you are storing them the public file system, Drupal does not really interact with them other than to provide the URL. The .htaccess rules check if the request is for a real file. If it is a real file, the web server service it up. So for individual files, it is more about can your webserver handle the load. You probably want to look at using a static ...


1

uid shouldn't be 0, just change 'uid' => '0' by 'uid'=> \Drupal::currentUser()->id(): $file_data = file_get_contents('http://www.africau.edu/images/default/sample.pdf'); $file = file_save_data($file_data, 'public://3010.pdf', FILE_EXISTS_REPLACE); $media = Media::create([ 'bundle' => 'file', 'uid' => \Drupal::...


0

As i understand you could use something like this '#type' => 'file' $form['image_file']=array( '#type' => 'file', '#title' => t('Upload YourImage'), '#upload_validators' => array( 'file_validate_extensions' => array('gif'),), ); return $form;


0

There was a fault with my migration yaml. The destination field in Drupal 8 was field_media_audio but as you can see in the question I had it trying to save to field_audio_fileinfo which was the Drupal 7 source. Silly me. Once I realised and corrected the destination it all worked and now media is created and referenced in the one pass of my migration ...


1

Please see: https://www.drupal.org/project/drupal/issues/2247257 The uuid under the effects array is used as a "unique ID" for the effect. Seems technically it "works as designed", but as you can see from the linked project task, there is talk about if it's designed correctly. Fortunately, the uuid under the effects array is scoped to that effects ...


0

When I have done a similar type of migration at that time I did the following steps: First I created media type Audio in Drupal 8 and it's fields. Then I exported all audio file details and FID from D7 and created csv file. Written migration script to import audio into media. Example: source: plugin: csv path: 'csv file path' header_row_count: 1 ...


0

Thank you @Jdrupal, with reference to your answer I have updated 'block' to 'block_content' and it is working fine. $blocks = \Drupal::entityTypeManager() ->getStorage('block_content') ->loadByProperties(['logo1' => $media_id_1, 'logo2' => $media_id_2]);


1

You can use the entityTypeManager, like this: $blocks = \Drupal::entityTypeManager()->getStorage('block')->loadByProperties(['field_media_1' => $media_id, 'field_media_2' => $media_id]); Where $media_id the the is of your media entity. That will give you all the blocks that references that media entity.


0

So, as in the comment addresses, Instagram and Facebook changed the API to access Instagram and right now only creators and business accounts are fully supported. There is a spin off of the D7 instagram block module but it’s not done yet. I don’t think the API will let you access other users content, but from what little I poked around they probably have ...


Top 50 recent answers are included