fix #777 preview in quarantine

This commit is contained in:
Nicolas Le Goff
2012-07-02 18:45:27 +02:00
parent a6dc85092e
commit 06eecb913f
6 changed files with 161 additions and 95 deletions

View File

@@ -9,6 +9,9 @@
* file that was distributed with this source code.
*/
use MediaAlchemyst\Exception\Exception as MediaAlchemystException;
use MediaAlchemyst\Specification\Image as ImageSpec;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
@@ -84,6 +87,24 @@ class patch_370a7 implements patchInterface
$filePath = __DIR__ . '/../../../tmp/lazaret/' . $row['filepath'];
if (file_exists($filePath)) {
$spec = new ImageSpec();
$spec->setResizeMode(ImageSpec::RESIZE_MODE_INBOUND_FIXEDRATIO);
$spec->setDimensions(375, 275);
$thumbPass = sprintf("thumb_%s", $filePath);
try {
$Core['media-alchemyst']
->open($filePath)
->turnInto($thumbPass, $spec)
->close();
} catch (MediaAlchemystException $e) {
}
$media = $Core['mediavorus']->guess(new \SplFileInfo($filePath));
$collection = \collection::get_from_base_id($row['base_id']);
@@ -111,7 +132,8 @@ class patch_370a7 implements patchInterface
}
$lazaretFile->setOriginalName($row['filename']);
$lazaretFile->setPathname(__DIR__ . '/../../../tmp/lazaret/' . $row['filepath']);
$lazaretFile->setPathname($row['filepath']);
$lazaretFile->setThumbPathname($thumbPass);
$lazaretFile->setCreated(new \DateTime($row['created_on']));
$lazaretFile->setSession($lazaretSession);