diff --git a/src/Colors/Profile.php b/src/Colors/Profile.php index b6383509..c8bc1209 100644 --- a/src/Colors/Profile.php +++ b/src/Colors/Profile.php @@ -5,9 +5,20 @@ declare(strict_types=1); namespace Intervention\Image\Colors; use Intervention\Image\File; +use Intervention\Image\Exceptions\RuntimeException; use Intervention\Image\Interfaces\ProfileInterface; class Profile extends File implements ProfileInterface { - // + /** + * Create profile object from path in file system + * + * @param string $path + * @throws RuntimeException + * @return Profile + */ + public static function fromPath(string $path): self + { + return new self(fopen($path, 'r')); + } } diff --git a/tests/Unit/Colors/ProfileTest.php b/tests/Unit/Colors/ProfileTest.php new file mode 100644 index 00000000..200eb559 --- /dev/null +++ b/tests/Unit/Colors/ProfileTest.php @@ -0,0 +1,18 @@ +getTestResourcePath()); + $this->assertInstanceOf(Profile::class, $profile); + $this->assertTrue($profile->size() > 0); + } +}