D8 – Create media from blob

I am receiving a payload with blob files. I would like to store them as files and create a media entity. Here’s the code I have to create the Media object if (!empty($payload[‘blobFile’])) { $name = str_replace(‘ ‘, ‘_’, $payload[‘fileName’]); $file = file_save_data($payload[‘blobFile’], ‘public://’ . $name, FILE_EXISTS_REPLACE); $content[‘field_media_file’] = [‘target_id’ => $file->id()]; } $this->entityTypeManager->getStorage(…. It…

Details

image not showing on tag

<img class=”lazy” data-src=”lazy-image.jpg”> <img class=”lazy” data-src=”lazy-image.jpg”> <img class=”lazy” data-src=”lazy-image.jpg”> const io = new IntersectionObserver((entries) => entries.forEach((entry) => { // set image source only when it is in the viewport if (entry.isIntersecting) { const image = entry.target; // setting image source from the dataset image.src = image.dataset.src; // when image is loaded, we do not need…

Details