1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-26 23:35:12 +02:00

adopt new fileinfo after save

This commit is contained in:
Oliver Vogel
2014-04-02 13:26:43 +02:00
parent bf91911649
commit dd9d144ce8
2 changed files with 15 additions and 0 deletions

View File

@@ -1726,6 +1726,9 @@ class Image
throw new Exception\ImageNotWritableException("Can't write image data to path [{$path}]");
}
// set new file info
$this->setFileInfoFromPath($path);
return $this;
}

View File

@@ -1525,17 +1525,29 @@ class ImageTest extends PHPUnit_Framework_Testcase
$img = $this->getTestImage();
$img->save($save_as);
$this->assertFileExists($save_as);
$this->assertEquals($img->dirname, 'public');
$this->assertEquals($img->basename, 'test2.jpg');
$this->assertEquals($img->extension, 'jpg');
$this->assertEquals($img->filename, 'test2');
@unlink($save_as);
$save_as = 'public/test2.png';
$img = $this->getTestImage();
$img->save($save_as, 80);
$this->assertEquals($img->dirname, 'public');
$this->assertEquals($img->basename, 'test2.png');
$this->assertEquals($img->extension, 'png');
$this->assertEquals($img->filename, 'test2');
$this->assertFileExists($save_as);
@unlink($save_as);
$save_as = 'public/test2.jpg';
$img = $this->getTestImage();
$img->save($save_as, 0);
$this->assertEquals($img->dirname, 'public');
$this->assertEquals($img->basename, 'test2.jpg');
$this->assertEquals($img->extension, 'jpg');
$this->assertEquals($img->filename, 'test2');
$this->assertFileExists($save_as);
@unlink($save_as);
}