コード例 #1
0
ファイル: FileTest.php プロジェクト: tapakan/file
 public function testExists()
 {
     $true = File::exists(__DIR__ . '/bootstrap.php');
     $false = File::exists(__DIR__ . '/autoload.php');
     $this->assertEquals(true, $true);
     $this->assertEquals(false, $false);
 }
コード例 #2
0
ファイル: Watermark.php プロジェクト: tapakan/watermark
 /**
  * Add watermark to image.
  *
  * @param string $path Path to image file.
  */
 public function add($path)
 {
     if (!($image = $this->path->path($path))) {
         throw new \InvalidArgumentException("Image \"{$path}\" doesn't exists");
     }
     $img = $this->getResource($image);
     $img = $this->addWatermark($img);
     $ext = File::getExt($image);
     $func = 'image' . ($ext == 'jpg' ? 'jpeg' : $ext);
     return call_user_func_array($func, [$img, $image, 100]);
 }