/** * Test that the file factory can create a Codesleeve\Stapler\UploadedFile * object from a string filepath. * * @test * @return void */ public function it_should_be_able_to_build_a_stapler_uploaded_file_object_from_a_string_file_path() { $uploadedFile = File::create(__DIR__ . '/../Fixtures/empty.gif'); $this->assertInstanceOf('Codesleeve\\Stapler\\File\\FileInterface', $uploadedFile); }
/** * Rebuilds the images for this attachment. */ public function reprocess() { if (!$this->originalFilename()) { return; } foreach ($this->styles as $style) { $fileLocation = $this->storage == 'filesystem' ? $this->path('original') : $this->url('original'); $file = FileFactory::create($fileLocation); if ($style->dimensions && $file->isImage()) { $file = $this->resizer->resize($file, $style); } else { $file = $file->getRealPath(); } $filePath = $this->path($style->name); $this->move($file, $filePath); } }