function testLetterboxSixCharHex()
 {
     $data = array();
     $file_loc = TestTimberImage::copyTestImage('eastern.jpg');
     $upload_dir = wp_upload_dir();
     $new_file = TimberImageHelper::letterbox($upload_dir['url'] . '/eastern.jpg', 500, 500, '#FFFFFF', true);
     $location_of_image = TimberImageHelper::get_server_location($new_file);
     $this->assertTrue(TestTimberImage::checkSize($location_of_image, 500, 500));
     //whats the bg/color of the image
     $image = imagecreatefromjpeg($location_of_image);
     $pixel_rgb = imagecolorat($image, 1, 1);
     $colors = imagecolorsforindex($image, $pixel_rgb);
     $this->assertEquals(255, $colors['red']);
     $this->assertEquals(255, $colors['blue']);
     $this->assertEquals(255, $colors['green']);
 }
Ejemplo n.º 2
0
 function testPNGtoJPG()
 {
     $file_loc = self::copyTestImage('eastern-trans.png');
     $upload_dir = wp_upload_dir();
     $new_file = TimberImageHelper::img_to_jpg($upload_dir['url'] . '/eastern-trans.png', '#FFFF00');
     $location_of_image = TimberImageHelper::get_server_location($new_file);
     $this->assertFileExists($location_of_image);
     $image = imagecreatefromjpeg($location_of_image);
     $pixel_rgb = imagecolorat($image, 1, 1);
     $colors = imagecolorsforindex($image, $pixel_rgb);
     $this->assertEquals(255, $colors['red']);
     $this->assertEquals(255, $colors['green']);
     $this->assertEquals(0, $colors['blue']);
 }