mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-21 20:48:00 +01:00
Thumbs now crop while cover have variable height
This commit is contained in:
parent
2733071468
commit
ccb7361547
2 changed files with 7 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,3 +9,4 @@ Homestead.yaml
|
||||||
_ide_helper.php
|
_ide_helper.php
|
||||||
.idea
|
.idea
|
||||||
resources/views/emails/html
|
resources/views/emails/html
|
||||||
|
/composer.phar
|
||||||
|
|
|
@ -57,10 +57,10 @@ class Image extends Model
|
||||||
const SMALL = 4;
|
const SMALL = 4;
|
||||||
|
|
||||||
public static $ImageTypes = [
|
public static $ImageTypes = [
|
||||||
self::NORMAL => ['id' => self::NORMAL, 'name' => 'normal', 'width' => 350, 'height' => 350],
|
self::NORMAL => ['id' => self::NORMAL, 'name' => 'normal', 'width' => 350, 'height' => 350, 'geometry' => '350'],
|
||||||
self::ORIGINAL => ['id' => self::ORIGINAL, 'name' => 'original', 'width' => null, 'height' => null],
|
self::ORIGINAL => ['id' => self::ORIGINAL, 'name' => 'original', 'width' => null, 'height' => null, 'geometry' => null],
|
||||||
self::SMALL => ['id' => self::SMALL, 'name' => 'small', 'width' => 100, 'height' => 100],
|
self::SMALL => ['id' => self::SMALL, 'name' => 'small', 'width' => 100, 'height' => 100, 'geometry' => '100x100^'],
|
||||||
self::THUMBNAIL => ['id' => self::THUMBNAIL, 'name' => 'thumbnail', 'width' => 50, 'height' => 50]
|
self::THUMBNAIL => ['id' => self::THUMBNAIL, 'name' => 'thumbnail', 'width' => 50, 'height' => 50, 'geometry' => '50x50^']
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function getImageTypeFromName($name)
|
public static function getImageTypeFromName($name)
|
||||||
|
@ -136,8 +136,8 @@ class Image extends Model
|
||||||
$command .= ' -quality 95 -format png';
|
$command .= ' -quality 95 -format png';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($coverType['width']) && isset($coverType['height'])) {
|
if (isset($coverType['geometry'])) {
|
||||||
$command .= " -thumbnail ${coverType['width']}x${coverType['height']} -gravity center -extent ${coverType['width']}x${coverType['height']}";
|
$command .= " -gravity center -thumbnail ${coverType['geometry']} -extent ${coverType['geometry']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$command .= ' "'.$image->getFile($coverType['id']).'"';
|
$command .= ' "'.$image->getFile($coverType['id']).'"';
|
||||||
|
|
Loading…
Reference in a new issue