mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
fix port to 4.1 extract xmp:PageImage indesign
This commit is contained in:
12
composer.lock
generated
12
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "64830cb4d53b32b47e02d4a19df9cef2",
|
||||
"content-hash": "6341722edcd5bfa22e933f5411225144",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alchemy-fr/tcpdf-clone",
|
||||
@@ -383,16 +383,16 @@
|
||||
},
|
||||
{
|
||||
"name": "alchemy/phpexiftool",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alchemy-fr/PHPExiftool.git",
|
||||
"reference": "7372ca4e43473328bf06bca810558fbad7bb2f95"
|
||||
"reference": "ba1cb51eceb6562d7996023478977a8739de188b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/alchemy-fr/PHPExiftool/zipball/7372ca4e43473328bf06bca810558fbad7bb2f95",
|
||||
"reference": "7372ca4e43473328bf06bca810558fbad7bb2f95",
|
||||
"url": "https://api.github.com/repos/alchemy-fr/PHPExiftool/zipball/ba1cb51eceb6562d7996023478977a8739de188b",
|
||||
"reference": "ba1cb51eceb6562d7996023478977a8739de188b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -452,7 +452,7 @@
|
||||
"exiftool",
|
||||
"metadata"
|
||||
],
|
||||
"time": "2017-05-18T19:04:04+00:00"
|
||||
"time": "2019-02-13T13:06:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "alchemy/queue-bundle",
|
||||
|
@@ -61,7 +61,7 @@ class SubdefGenerator
|
||||
|
||||
public function generateSubdefs(\record_adapter $record, array $wanted_subdefs = null)
|
||||
{
|
||||
if ($record->get_hd_file() !== null) {
|
||||
if ($record->get_hd_file() !== null && $record->get_hd_file()->getMimeType() == "application/x-indesign") {
|
||||
$mediaSource = $this->mediavorus->guess($record->get_hd_file()->getPathname());
|
||||
$metadatas = $mediaSource->getMetadatas();
|
||||
|
||||
@@ -69,15 +69,27 @@ class SubdefGenerator
|
||||
if(!isset($this->tmpFilesystem)){
|
||||
$this->tmpFilesystem = Manager::create();
|
||||
}
|
||||
$tmpDir = $this->tmpFilesystem->createTemporaryDirectory();
|
||||
$tmpDir = $this->tmpFilesystem->createTemporaryDirectory(0777, 500);
|
||||
|
||||
try {
|
||||
$this->app['filesystem']->dumpFile($tmpDir.'/file.jpg', $metadatas->get('XMP-xmp:PageImage')->getValue()->asString());
|
||||
$this->tmpFilePath = $tmpDir.'/file.jpg';
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error(sprintf('Unable to write temporary file : %s', $e->getMessage()));
|
||||
$files = $this->app['exiftool.preview-extractor']->extract($record->get_hd_file()->getPathname(), $tmpDir);
|
||||
|
||||
$selected = null;
|
||||
$size = null;
|
||||
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir() || $file->isDot()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_null($selected) || $file->getSize() > $size) {
|
||||
$selected = $file->getPathname();
|
||||
$size = $file->getSize();
|
||||
}
|
||||
}
|
||||
|
||||
if ($selected) {
|
||||
$this->tmpFilePath = $selected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user