Esempio n. 1
0
 public function testPutFileHandle()
 {
     $png = create_png();
     $tmp_file = create_tmp_file($png);
     $test = new Test();
     $test->curl->setHeader('X-DEBUG-TEST', 'put_file_handle');
     $test->curl->setOpt(CURLOPT_PUT, TRUE);
     $test->curl->setOpt(CURLOPT_INFILE, $tmp_file);
     $test->curl->setOpt(CURLOPT_INFILESIZE, strlen($png));
     $test->curl->put(Test::TEST_URL);
     fclose($tmp_file);
     $this->assertTrue($test->curl->response === 'image/png');
 }
Esempio n. 2
0
                }
                $image .= substr($hold_chars[$char][$l], 1);
                $j++;
            }
            for ($k = $offset_x + $img_width; $k < $total_width; $k++) {
                $image .= chr(255);
            }
            $l++;
        } else {
            for ($k = 0; $k < $total_width; $k++) {
                $image .= chr(255);
            }
        }
    }
    unset($hold);
    $image = create_png(gzcompress($image), $total_width, $total_height);
    // Output image
    header('Content-Type: image/png');
    header('Cache-control: no-cache, no-store');
    echo $image;
    unset($image);
    unset($_png);
    exit;
} else {
    if (!empty($HTTP_GET_VARS['c'])) {
        $_png = define_raw_pngs();
        $char = substr($code, intval($HTTP_GET_VARS['c']) - 1, 1);
        header('Content-Type: image/png');
        header('Cache-control: no-cache, no-store');
        echo base64_decode($_png[$char]);
        unset($_png);
Esempio n. 3
0
function get_png()
{
    $tmp_filename = tempnam('/tmp', 'php-curl-class.');
    file_put_contents($tmp_filename, create_png());
    return $tmp_filename;
}
            }
            $image .= randomise(substr($hold_chars[$char][$l], 1), $char_widths[$j]);
            $j++;
        }
        for ($k = $offset_x + $img_width; $k < $total_width; $k++) {
            $image .= chr(mt_rand(140, 255));
        }
        $l++;
    } else {
        for ($k = 0; $k < $total_width; $k++) {
            $image .= chr(mt_rand(140, 255));
        }
    }
}
unset($hold);
$image = create_png($image, $total_width, $total_height);
// Output image
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');
echo $image;
unset($image);
unset($_png);
exit;
// This is designed to randomise the pixels of the image data within
// certain limits so as to keep it readable. It also varies the image
// width a little
function randomise($scanline, $width)
{
    $new_line = '';
    $start = floor($width / 2);
    $end = strlen($scanline) - ceil($width / 2);
 function test_ignores_image_formats_from_query_settings()
 {
     $png = create_png();
     $large_image = wp_get_attachment_metadata($png);
     $image = '<img src="' . $this->upload_url . '/' . $large_image['file'] . '">';
     $post = wp_insert_post(array('post_name' => 'png', 'post_content' => $image, 'post_status' => 'publish'));
     $expected = '<p><img src="http://example.org/wp-content/uploads/2014/12/logo.png"></p>';
     $post = get_posts(array('p' => $post, 'rwp_settings' => array('ignored_image_formats' => array('png'))));
     $post = trim(apply_filters('the_content', $post[0]->post_content));
     $this->assertEquals($expected, $post);
 }