mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 23:43:12 +00:00
resize collection pic 120 * 24 max
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
|
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
|
||||||
|
use MediaAlchemyst\Specification\Image as ImageSpecification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -101,6 +102,20 @@ class appbox extends base
|
|||||||
if ( ! in_array(mb_strtolower($pathfile->getMimeType()), array('image/gif', 'image/png', 'image/jpeg', 'image/jpg', 'image/pjpeg'))) {
|
if ( ! in_array(mb_strtolower($pathfile->getMimeType()), array('image/gif', 'image/png', 'image/jpeg', 'image/jpg', 'image/pjpeg'))) {
|
||||||
throw new \InvalidArgumentException('Invalid file format');
|
throw new \InvalidArgumentException('Invalid file format');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//resize collection logo
|
||||||
|
$imageSpec = new ImageSpecification();
|
||||||
|
$imageSpec->setResizeMode(ImageSpecification::RESIZE_MODE_INBOUND_FIXEDRATIO);
|
||||||
|
$imageSpec->setDimensions(120, 24);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$core['media-alchemyst']
|
||||||
|
->open($pathfile->getPathname())
|
||||||
|
->turninto($pathfile->getPathname(), $imageSpec)
|
||||||
|
->close();
|
||||||
|
} catch (\MediaAlchemyst\Exception $e) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($pic_type) {
|
switch ($pic_type) {
|
||||||
@@ -132,7 +147,7 @@ class appbox extends base
|
|||||||
$core['file-system']->remove($target);
|
$core['file-system']->remove($target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($target)) {
|
if (null === $target || null === $pathfile) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user