Exemple #1
0
 public function testAutoDestructWithRelease()
 {
     $img = WideImage_TrueColorImage::create(10, 10);
     $handle = $img->getHandle();
     $img->releaseHandle();
     unset($img);
     $this->assertTrue(WideImage::isValidImageHandle($handle));
     imagedestroy($handle);
 }
Exemple #2
0
 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);
 }
Exemple #3
0
 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));
 }
Exemple #4
0
 /**
  * @return bool True, if the image object holds a valid GD image, false otherwise
  */
 function isValid()
 {
     return WideImage::isValidImageHandle($this->handle);
 }