Upgrade to 3.2.0

This commit is contained in:
Bastian Allgeier
2019-06-25 09:56:08 +02:00
parent 9e18cf635d
commit 9c89153d35
296 changed files with 14408 additions and 2504 deletions

View File

@@ -2,8 +2,16 @@
namespace Kirby\Cms;
use Kirby\Exception\InvalidArgumentException;
/**
* Resizing, blurring etc
* Resizing, blurring etc.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
trait FileModifications
{
@@ -12,7 +20,7 @@ trait FileModifications
* Blurs the image by the given amount of pixels
*
* @param boolean $pixels
* @return self
* @return Kirby\Cms\FileVersion|Kirby\Cms\File
*/
public function blur($pixels = true)
{
@@ -22,7 +30,7 @@ trait FileModifications
/**
* Converts the image to black and white
*
* @return self
* @return Kirby\Cms\FileVersion|Kirby\Cms\File
*/
public function bw()
{
@@ -35,7 +43,7 @@ trait FileModifications
* @param integer $width
* @param integer $height
* @param string|array $options
* @return self
* @return Kirby\Cms\FileVersion|Kirby\Cms\File
*/
public function crop(int $width, int $height = null, $options = null)
{
@@ -65,7 +73,7 @@ trait FileModifications
* Sets the JPEG compression quality
*
* @param integer $quality
* @return self
* @return Kirby\Cms\FileVersion|Kirby\Cms\File
*/
public function quality(int $quality)
{
@@ -79,7 +87,7 @@ trait FileModifications
* @param integer $width
* @param integer $height
* @param integer $quality
* @return self
* @return Kirby\Cms\FileVersion|Kirby\Cms\File
*/
public function resize(int $width = null, int $height = null, int $quality = null)
{
@@ -97,7 +105,7 @@ trait FileModifications
* @since 3.1.0
*
* @param array|string $sizes
* @return string
* @return string|null
*/
public function srcset($sizes = null): ?string
{
@@ -116,15 +124,22 @@ trait FileModifications
$set = [];
foreach ($sizes as $key => $value) {
if (is_string($value) === true) {
$size = $key;
$attr = $value;
if (is_array($value)) {
$options = $value;
$condition = $key;
} elseif (is_string($value) === true) {
$options = [
'width' => $key
];
$condition = $value;
} else {
$size = $value;
$attr = $value . 'w';
$options = [
'width' => $value
];
$condition = $value . 'w';
}
$set[] = $this->resize($size)->url() . ' ' . $attr;
$set[] = $this->thumb($options)->url() . ' ' . $condition;
}
return implode(', ', $set);
@@ -135,12 +150,12 @@ trait FileModifications
* The media manager takes care of generating
* those modified versions and putting them
* in the right place. This is normally the
* /media folder of your installation, but
* `/media` folder of your installation, but
* could potentially also be a CDN or any other
* place.
*
* @param array|null|string $options
* @return FileVersion|File
* @return Kirby\Cms\FileVersion|Kirby\Cms\File
*/
public function thumb($options = null)
{