Пример #1
0
<?php

chdir('..');
include 'common.inc';
$id = $_REQUEST['id'];
$valid = false;
$done = false;
$ini = null;
$title = "Web page visual comparison";
$dir = GetVideoPath($id);
if (is_dir("./{$dir}")) {
    $valid = true;
    $ini = parse_ini_file("./{$dir}/video.ini");
    if (isset($ini['completed'])) {
        $done = true;
        GenerateThumbnail("./{$dir}");
    }
    // get the video time
    $date = date("M j, Y", filemtime("./{$dir}"));
    if (is_file("./{$dir}/video.mp4")) {
        $date = date("M j, Y", filemtime("./{$dir}/video.mp4"));
    }
    $title .= " - {$date}";
    $labels = json_decode(file_get_contents("./{$dir}/labels.txt"), true);
    if (count($labels)) {
        $title .= ' : ';
        foreach ($labels as $index => $label) {
            if ($index > 0) {
                $title .= ", ";
            }
            $title .= $label;
Пример #2
0
                $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}");
                }
            }
        }
        if ($img) {
            header('Last-Modified: ' . gmdate('r'));
            header('Expires: ' . gmdate('r', time() + 31536000));
            GenerateThumbnail($img, $type);
            SendImage($img, $type);
        } else {
            header("HTTP/1.0 404 Not Found");
        }
    }
}
/**
* Draw the waterfall image
*
* @param TestStepResult $testStepResult Step results to draw the waterfall for
* @param resource $img
*/
function tbnDrawWaterfall($testStepResult, &$img)
{
    global $id;
Пример #3
0
    }
    echo file_get_contents($CacheTemplateImageFile);
    die;
} elseif (file_exists($TemplateImageFile)) {
    if (!is_dir(ISC_BASE_PATH . '/cache/tplthumbs/')) {
        mkdir(ISC_BASE_PATH . '/cache/tplthumbs/');
        isc_chmod(ISC_BASE_PATH . '/cache/tplthumbs/', ISC_WRITEABLE_DIR_PERM);
    }
    if ((strtolower(substr($TemplateImageFile, -4)) == ".jpg" || strtolower(substr($TemplateImageFile, -5)) == ".jpeg") && function_exists('imagejpeg')) {
        // jpeg image
        header("Content-type: image/jpeg");
    } elseif (strtolower(substr($TemplateImageFile, -4)) == ".gif" && function_exists('imagegif')) {
        // gif image
        header("Content-type: image/gif");
    }
    GenerateThumbnail($TemplateImageFile, $CacheTemplateImageFile, 200);
    if (file_exists($CacheTemplateImageFile)) {
        echo file_get_contents($CacheTemplateImageFile);
    } else {
        OutputNoImage();
    }
    die;
} else {
    OutputNoImage();
}
function OutputNoImage()
{
    header("Content-type: image/gif");
    echo file_get_contents(ISC_BASE_PATH . '/admin/images/nopreview200.gif');
    die;
}
Пример #4
0
 /**
  * Save an incoming vendor image (from the user's browser) in to the file system.
  *
  * @param int The vendor ID that this image should be attached to.
  * @param string The type of image to upload - either self::VENDOR_LOGO or self::VENDOR_PHOTO
  * @return string The path to the vendor image uploaded.
  */
 private function SaveVendorImage($vendorId, $imageType)
 {
     // No image to save, so it's OK
     if (!isset($_FILES['vendor' . $imageType]) || !is_uploaded_file($_FILES['vendor' . $imageType]['tmp_name'])) {
         return '';
     }
     $maxDimensions = GetConfig('Vendor' . ucfirst($imageType) . 'Size');
     if (!$maxDimensions) {
         @unlink($_FILES['vendor' . $imageType]['tmp_name']);
         return '';
     }
     list($maxWidth, $maxHeight) = explode('x', $maxDimensions);
     $ext = GetFileExtension($_FILES['vendor' . $imageType]['name']);
     $imageName = 'vendor_images/' . $vendorId . '_' . $imageType . '.' . $ext;
     $destLocation = ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $imageName;
     // Attempt to move the image over (some hosts have problems working with files in the temp directory)
     if (!move_uploaded_file($_FILES['vendor' . $imageType]['tmp_name'], $destLocation)) {
         @unlink($_FILES['vendor' . $imageType]['tmp_name']);
         return false;
     }
     $thumbnail = GenerateThumbnail($destLocation, $destLocation, $maxWidth, $maxHeight);
     if (!$thumbnail) {
         return false;
     }
     // Otherwise, return the location of the image
     return $imageName;
 }
Пример #5
0
 /**
  * Avatars are hex-encoded in the database.
  */
 public function ExportHexAvatars($Thumbnail = true)
 {
     $this->Ex->Comment("Exporting hex encoded columns...");
     $Result = $this->Ex->Query("select UserID, Length, ContentType, Content from :_UserAvatar");
     $Path = '/www/porter/userpics';
     $Count = 0;
     while ($Row = mysql_fetch_assoc($Result)) {
         // Build path
         if (!file_exists(dirname($Path))) {
             $R = mkdir(dirname($Path), 0777, true);
             if (!$R) {
                 die("Could not create " . dirname($Path));
             }
         }
         $PhotoPath = $Path . '/pavatar' . $Row['UserID'] . '.jpg';
         file_put_contents($PhotoPath, hex2bin($Row['Content']));
         $this->Ex->Status('.');
         if ($Thumbnail) {
             if ($Thumbnail === true) {
                 $Thumbnail = 50;
             }
             //$PicPath = str_replace('/avat', '/pavat', $PhotoPath);
             $ThumbPath = str_replace('/pavat', '/navat', $PhotoPath);
             GenerateThumbnail($PhotoPath, $ThumbPath, $Thumbnail, $Thumbnail);
         }
         $Count++;
     }
     $this->Ex->Status("{$Count} Hex Encoded.\n");
     $this->Ex->Comment("{$Count} Hex Encoded.", false);
 }