We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4452e3a commit f42a502Copy full SHA for f42a502
src/ImageResize.php
@@ -72,8 +72,16 @@ public static function createFromString($imageData) {
72
*/
73
public function __construct($filename = null)
74
{
75
- if (!empty($filename)) {
+ if ($filename !== null) {
76
$this->loadFromFile($filename);
77
+ } else {
78
+ // if no filename is provided, we want to throw an exception if
79
+ // the object was not created in one of it's static method
80
+ $backtrace = debug_backtrace();
81
+
82
+ if (!isset($backtrace[1]['class']) || $backtrace[1]['class'] != __CLASS__) {
83
+ throw new \Exception('No image provided');
84
+ }
85
}
86
87
0 commit comments