Inheritance: extends Faker\Provider\Base
コード例 #1
0
 public function testDownloadWithDefaults()
 {
     $url = "http://www.lorempixel.com/";
     $curlPing = curl_init($url);
     curl_setopt($curlPing, CURLOPT_TIMEOUT, 5);
     curl_setopt($curlPing, CURLOPT_CONNECTTIMEOUT, 5);
     curl_setopt($curlPing, CURLOPT_RETURNTRANSFER, true);
     $data = curl_exec($curlPing);
     $httpCode = curl_getinfo($curlPing, CURLINFO_HTTP_CODE);
     curl_close($curlPing);
     if ($httpCode < 200 | $httpCode > 300) {
         $this->markTestSkipped("LoremPixel is offline, skipping image download");
     }
     $file = Image::image(sys_get_temp_dir());
     $this->assertFileExists($file);
     if (function_exists('getimagesize')) {
         list($width, $height, $type, $attr) = getimagesize($file);
         $this->assertEquals(640, $width);
         $this->assertEquals(480, $height);
         $this->assertEquals(constant('IMAGETYPE_JPEG'), $type);
     } else {
         $this->assertEquals('jpg', pathinfo($file, PATHINFO_EXTENSION));
     }
     if (file_exists($file)) {
         unlink($file);
     }
 }
コード例 #2
0
 public function testDownloadWithDefaults()
 {
     $file = Image::image(sys_get_temp_dir());
     $this->assertFileExists($file);
     if (function_exists('getimagesize')) {
         list($width, $height, $type, $attr) = getimagesize($file);
         $this->assertEquals(640, $width);
         $this->assertEquals(480, $height);
         $this->assertEquals(constant('IMAGETYPE_JPEG'), $type);
     } else {
         $this->assertEquals('jpg', pathinfo($file, PATHINFO_EXTENSION));
     }
     if (file_exists($file)) {
         unlink($file);
     }
 }
コード例 #3
0
ファイル: AuthController.php プロジェクト: cruni505/prestomed
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'phone' => $data['phone'], 'cell_phone' => $data['cell_phone'], 'address_1' => $data['address_1'], 'address_2' => $data['address_2'], 'profile_img' => (string) Image::make($data['profile_img'])->resize(100, 100)->encode('data-url'), 'password' => bcrypt($data['password'])]);
 }
コード例 #4
0
 protected function profilepic($imgfile, $path, $iduser)
 {
     $img = Image::make($path . '/' . $iduser . '/' . $imgfile)->resize(300, 300);
     $img->move($path, $imgfile);
 }
コード例 #5
0
 /**
  * @param $fakeDir
  *
  * @return string
  */
 protected function createImage($fakeDir)
 {
     $faker = Faker\Factory::create('fr_FR');
     $image = Faker\Provider\Image::image();
     $result = sprintf("%s/image-%s.jpg", $fakeDir, $faker->slug(3));
     rename($image, $result);
     return $result;
 }