protected function MediaPdfThumbnailImageManager::createThumbnailFileEntity in Media PDF Thumbnail 8.2
Same name and namespace in other branches
- 8.4 src/Manager/MediaPdfThumbnailImageManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImageManager::createThumbnailFileEntity()
- 8 src/Manager/MediaPdfThumbnailImageManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImageManager::createThumbnailFileEntity()
- 8.3 src/Manager/MediaPdfThumbnailImageManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImageManager::createThumbnailFileEntity()
Create file entity.
Parameters
string $fileUri: File uri.
Return value
int|null|string File entity id.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Core\Entity\EntityStorageException
1 call to MediaPdfThumbnailImageManager::createThumbnailFileEntity()
- MediaPdfThumbnailImageManager::createThumbnail in src/
Manager/ MediaPdfThumbnailImageManager.php - Create pdf thumbnail.
File
- src/
Manager/ MediaPdfThumbnailImageManager.php, line 114
Class
- MediaPdfThumbnailImageManager
- Class MediaPdfThumbnailImageManager.
Namespace
Drupal\media_pdf_thumbnail\ManagerCode
protected function createThumbnailFileEntity($fileUri) {
$fileUri = str_replace('.pdf', '.pdf.jpeg', $fileUri);
$fileEntity = $this->entityTypeManager
->getStorage('file')
->create([
'uri' => $fileUri,
'status' => FILE_STATUS_PERMANENT,
]);
$fileEntity
->save();
return $fileEntity
->id();
}