public function testAutoDestructWithRelease() { $img = WideImage_TrueColorImage::create(10, 10); $handle = $img->getHandle(); $img->releaseHandle(); unset($img); $this->assertTrue(WideImage::isValidImageHandle($handle)); imagedestroy($handle); }
public function testSaveAndLoad() { $handle = imagecreatefromgif(IMG_PATH . '100x100-color-hole.gif'); $this->mapper->save($handle, IMG_PATH . 'temp/test.gd'); $this->assertTrue(filesize(IMG_PATH . 'temp/test.gd') > 0); imagedestroy($handle); // file is a valid image $handle = $this->mapper->load(IMG_PATH . 'temp/test.gd'); $this->assertTrue(WideImage::isValidImageHandle($handle)); imagedestroy($handle); }
function testLoadFromHandle() { $handle = imagecreatefrompng(IMG_PATH . '100x100-rainbow.png'); $img = WideImage::loadFromHandle($handle); $this->assertValidImage($img); $this->assertTrue($img->isTrueColor()); $this->assertSame($handle, $img->getHandle()); $this->assertEquals(100, $img->getWidth()); $this->assertEquals(100, $img->getHeight()); unset($img); $this->assertFalse(WideImage::isValidImageHandle($handle)); }
/** * @return bool True, if the image object holds a valid GD image, false otherwise */ function isValid() { return WideImage::isValidImageHandle($this->handle); }