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); } }
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); } }
/** * 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'])]); }
protected function profilepic($imgfile, $path, $iduser) { $img = Image::make($path . '/' . $iduser . '/' . $imgfile)->resize(300, 300); $img->move($path, $imgfile); }
/** * @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; }