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 testThemeImageLetterbox()
 {
     $dest = get_template_directory() . '/images/cardinals.jpg';
     copy(__DIR__ . '/assets/cardinals.jpg', $dest);
     $image = get_template_directory_uri() . '/images/cardinals.jpg';
     $image = str_replace('http://example.org', '', $image);
     $letterboxed = TimberImageHelper::letterbox($image, 600, 300, '#FF0000');
     $this->assertFileExists(get_template_directory() . '/images/cardinals-lbox-600x300-FF0000.jpg');
     unlink(get_template_directory() . '/images/cardinals-lbox-600x300-FF0000.jpg');
 }
Ejemplo n.º 3
0
 function testThemeImageLetterbox()
 {
     if (!extension_loaded('gd')) {
         self::markTestSkipped('Letterbox image test requires GD extension');
     }
     $dest = get_template_directory() . '/images/cardinals.jpg';
     copy(__DIR__ . '/assets/cardinals.jpg', $dest);
     $image = get_template_directory_uri() . '/images/cardinals.jpg';
     $image = str_replace('http://example.org', '', $image);
     $letterboxed = TimberImageHelper::letterbox($image, 600, 300, '#FF0000');
     $this->assertFileExists(get_template_directory() . '/images/cardinals-lbox-600x300-FF0000.jpg');
     unlink(get_template_directory() . '/images/cardinals-lbox-600x300-FF0000.jpg');
 }