Exemple #1
0
 // make sure nobody is trying to use us to pull down external images from somewhere else
 if (strpos($file, ':') === FALSE && strpos($file, '//') === FALSE && strpos($file, '\\') === FALSE) {
     $fileParts = explode('.', $file);
     $parts = pathinfo($file);
     $type = $parts['extension'];
     $fit = max(min(@$_REQUEST['fit'], 1000), 0);
     $newWidth = 250;
     $w = @$_REQUEST['width'];
     if ($w && $w > 20 && $w < 1000) {
         $newWidth = $w;
     }
     $img = null;
     $testStepResult = TestStepResult::fromFiles(TestInfo::fromFiles($testPath), $run, $cached, $step);
     // see if it is a waterfall image
     if (strstr($parts['basename'], 'waterfall') !== false) {
         tbnDrawWaterfall($testStepResult, $img);
     } elseif (strstr($parts['basename'], 'optimization') !== false) {
         tbnDrawChecklist($testStepResult, $img);
     } else {
         if (!is_file("{$testPath}/{$file}")) {
             $file = str_ireplace('.jpg', '.png', $file);
             $parts = pathinfo($file);
             $type = $parts['extension'];
         }
         if (is_file("{$testPath}/{$file}")) {
             if (!strcasecmp($type, 'jpg')) {
                 $img = imagecreatefromjpeg("{$testPath}/{$file}");
             } elseif (!strcasecmp($type, 'gif')) {
                 $img = imagecreatefromgif("{$testPath}/{$file}");
             } else {
                 $img = imagecreatefrompng("{$testPath}/{$file}");
Exemple #2
0
 $file = $_GET['file'];
 // make sure nobody is trying to use us to pull down external images from somewhere else
 if (strpos($file, ':') === FALSE && strpos($file, '//') === FALSE && strpos($file, '\\') === FALSE) {
     $fileParts = explode('.', $file);
     $parts = pathinfo($file);
     $type = $parts['extension'];
     $fit = max(min(@$_REQUEST['fit'], 1000), 0);
     $newWidth = 250;
     $w = @$_REQUEST['width'];
     if ($w && $w > 20 && $w < 1000) {
         $newWidth = $w;
     }
     $img = null;
     // see if it is a waterfall image
     if (strstr($parts['basename'], 'waterfall') !== false) {
         tbnDrawWaterfall($img);
     } elseif (strstr($parts['basename'], 'optimization') !== false) {
         tbnDrawChecklist($img);
     } else {
         if (!is_file("{$testPath}/{$file}")) {
             $file = str_ireplace('.jpg', '.png', $file);
             $parts = pathinfo($file);
             $type = $parts['extension'];
         }
         if (is_file("{$testPath}/{$file}")) {
             if (!strcasecmp($type, 'jpg')) {
                 $img = imagecreatefromjpeg("{$testPath}/{$file}");
             } elseif (!strcasecmp($type, 'gif')) {
                 $img = imagecreatefromgif("{$testPath}/{$file}");
             } else {
                 $img = imagecreatefrompng("{$testPath}/{$file}");