sizeToReport = $kilobytes * 1024; }); } /** * Create a new fake image. * * @param string $name * @param int $width * @param int $height * @return \Illuminate\Http\Testing\File */ public function image($name, $width = 10, $height = 10) { return new File($name, $this->generateImage($width, $height)); } /** * Generate a dummy image of the given width and height. * * @param int $width * @param int $height * @return resource */ protected function generateImage($width, $height) { return tap(tmpfile(), function ($temp) use ($width, $height) { ob_start(); imagepng(imagecreatetruecolor($width, $height)); fwrite($temp, ob_get_clean()); }); } }