class MediaPdfThumbnailImagickManager in Media PDF Thumbnail 8.3
Same name and namespace in other branches
- 8.4 src/Manager/MediaPdfThumbnailImagickManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImagickManager
- 8 src/Manager/MediaPdfThumbnailImagickManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImagickManager
- 8.2 src/Manager/MediaPdfThumbnailImagickManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImagickManager
Class MediaPdfThumbnailImagickManager.
@package Drupal\media_pdf_thumbnail\Manager
Hierarchy
- class \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImagickManager
Expanded class hierarchy of MediaPdfThumbnailImagickManager
1 string reference to 'MediaPdfThumbnailImagickManager'
1 service uses MediaPdfThumbnailImagickManager
File
- src/
Manager/ MediaPdfThumbnailImagickManager.php, line 13
Namespace
Drupal\media_pdf_thumbnail\ManagerView source
class MediaPdfThumbnailImagickManager {
/**
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
*/
protected $logger;
/**
* MediaPdfThumbnailImagickManager constructor.
*
* @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerChannel
*/
public function __construct(LoggerChannelFactoryInterface $loggerChannel) {
$this->logger = $loggerChannel
->get('Media PDF Thumbnail');
}
/**
* Generate image from PDF file.
*
* @param string $source
* File source.
* @param string $target
* File target.
*
* @return string
* File path.
*
*/
public function generateImageFromPDF($source, $target) {
try {
$pdf = new Pdf($source);
$pdf
->saveImage($target);
} catch (\Exception $e) {
$this->logger
->error($e
->getMessage());
return FALSE;
}
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MediaPdfThumbnailImagickManager:: |
protected | property | ||
MediaPdfThumbnailImagickManager:: |
public | function | Generate image from PDF file. | |
MediaPdfThumbnailImagickManager:: |
public | function | MediaPdfThumbnailImagickManager constructor. |