diff --git a/src/Traits/AudioCodec.php b/src/Traits/AudioCodec.php index b954721..4d29fa3 100644 --- a/src/Traits/AudioCodec.php +++ b/src/Traits/AudioCodec.php @@ -12,6 +12,9 @@ trait AudioCodec */ public function AudioCodec($audioCodec) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->transcode(Transcode::audioCodec($audioCodec)); diff --git a/src/Traits/AudioFrequency.php b/src/Traits/AudioFrequency.php index 14b7b1d..6b3c1e4 100644 --- a/src/Traits/AudioFrequency.php +++ b/src/Traits/AudioFrequency.php @@ -12,6 +12,9 @@ trait AudioFrequency */ public function AudioFrequency($audioFrequency) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->transcode(Transcode::audioFrequency($audioFrequency)); diff --git a/src/Traits/BitRate.php b/src/Traits/BitRate.php index 60d80ca..c9661bf 100644 --- a/src/Traits/BitRate.php +++ b/src/Traits/BitRate.php @@ -10,6 +10,9 @@ trait BitRate */ public function BitRate($bitRate) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->bitRate($bitRate); diff --git a/src/Traits/Crop.php b/src/Traits/Crop.php index b7fc3b9..e4e9b8b 100644 --- a/src/Traits/Crop.php +++ b/src/Traits/Crop.php @@ -14,6 +14,9 @@ trait Crop */ public function Crop($width, $height, $gravity = null) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); if (empty($gravity) === true) { diff --git a/src/Traits/DPR.php b/src/Traits/DPR.php index 7cadc4a..5009e86 100644 --- a/src/Traits/DPR.php +++ b/src/Traits/DPR.php @@ -12,6 +12,9 @@ trait DPR */ public function DPR($dpr) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->delivery(Delivery::dpr($dpr)); diff --git a/src/Traits/Fill.php b/src/Traits/Fill.php index 963d43c..fa27d61 100644 --- a/src/Traits/Fill.php +++ b/src/Traits/Fill.php @@ -14,6 +14,9 @@ trait Fill */ public function Fill($width, $height, $gravity = null) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); if (empty($gravity) === true) { diff --git a/src/Traits/Fit.php b/src/Traits/Fit.php index 03b6c1e..063c3e5 100644 --- a/src/Traits/Fit.php +++ b/src/Traits/Fit.php @@ -14,6 +14,9 @@ trait Fit */ public function Fit($width, $height, $aspectRatio = null) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->resize(Resize::fit($width, $height, $aspectRatio)); diff --git a/src/Traits/Flag.php b/src/Traits/Flag.php index ecb3a9f..fdd8232 100644 --- a/src/Traits/Flag.php +++ b/src/Traits/Flag.php @@ -13,6 +13,9 @@ trait Flag */ public function Flag($flag, ...$options) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->addFlag(TransformationFlag::$flag(...$options)); diff --git a/src/Traits/Format.php b/src/Traits/Format.php index 8a25595..30b7ed3 100644 --- a/src/Traits/Format.php +++ b/src/Traits/Format.php @@ -13,6 +13,9 @@ trait Format */ public function Format($format) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->delivery(Delivery::format(TransformationFormat::$format())); diff --git a/src/Traits/KeyframeInterval.php b/src/Traits/KeyframeInterval.php index bc94016..5688bcb 100644 --- a/src/Traits/KeyframeInterval.php +++ b/src/Traits/KeyframeInterval.php @@ -10,6 +10,9 @@ trait KeyframeInterval */ public function KeyframeInterval($keyframeInterval) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->keyframeInterval($keyframeInterval); diff --git a/src/Traits/Limit.php b/src/Traits/Limit.php index f44bca7..808d9b0 100644 --- a/src/Traits/Limit.php +++ b/src/Traits/Limit.php @@ -14,6 +14,9 @@ trait Limit */ public function Limit($width, $height, $aspectRatio = null) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->resize(Resize::limitFit($width, $height, $aspectRatio)); diff --git a/src/Traits/LimitFill.php b/src/Traits/LimitFill.php index 27ca383..ad09095 100644 --- a/src/Traits/LimitFill.php +++ b/src/Traits/LimitFill.php @@ -14,6 +14,9 @@ trait LimitFill */ public function LimitFill($width, $height, $gravity = null) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); if (empty($gravity) === true) { diff --git a/src/Traits/MinimumFit.php b/src/Traits/MinimumFit.php index fe2de77..6ca733e 100644 --- a/src/Traits/MinimumFit.php +++ b/src/Traits/MinimumFit.php @@ -14,6 +14,9 @@ trait MinimumFit */ public function MinimumFit($width, $height, $aspectRatio = null) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->resize(Resize::minimumFit($width, $height, $aspectRatio)); diff --git a/src/Traits/Quality.php b/src/Traits/Quality.php index c3b936d..1dd5339 100644 --- a/src/Traits/Quality.php +++ b/src/Traits/Quality.php @@ -10,6 +10,9 @@ trait Quality */ public function Quality($quality) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->quality($quality); diff --git a/src/Traits/Scale.php b/src/Traits/Scale.php index adc79fc..db22ab6 100644 --- a/src/Traits/Scale.php +++ b/src/Traits/Scale.php @@ -14,6 +14,9 @@ trait Scale */ public function Scale($width, $height, $aspectRatio = null) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->resize(Resize::scale($width, $height, $aspectRatio)); diff --git a/src/Traits/Thumb.php b/src/Traits/Thumb.php index 03c1b4d..db0adaf 100644 --- a/src/Traits/Thumb.php +++ b/src/Traits/Thumb.php @@ -14,6 +14,9 @@ trait Thumb */ public function Thumb($width, $height, $gravity = null) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); if (empty($gravity) === true) { diff --git a/src/Traits/VideoCodec.php b/src/Traits/VideoCodec.php index 7da47f0..0af7616 100644 --- a/src/Traits/VideoCodec.php +++ b/src/Traits/VideoCodec.php @@ -12,6 +12,9 @@ trait VideoCodec */ public function VideoCodec($videoCodec) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->transcode(Transcode::videoCodec($videoCodec)); diff --git a/src/Traits/VideoSampling.php b/src/Traits/VideoSampling.php index aaedefb..0171472 100644 --- a/src/Traits/VideoSampling.php +++ b/src/Traits/VideoSampling.php @@ -10,6 +10,9 @@ trait VideoSampling */ public function VideoSampling($videoSampling) { + if (!$this->asset) { + return null; + } $clone = $this->clone(); $clone->asset->videoSampling($videoSampling);