Пример #1
0
     $whichFile2 = $realFolderName . $mediaFile;
     if (!copy(filename_decode($whichFile1), filename_decode($whichFile2))) {
         // the file cannot be copied
         $error .= $pgv_lang["upload_error"] . "<br />" . print_text('copy_error', 0, 1) . "<br />";
     } else {
         @chmod(filename_decode($whichFile2), PGV_PERM_FILE);
         AddToLog("Media file {$folderName}{$mediaFile} copied from {$thumbFolderName}{$mediaFile}");
     }
 }
 if ($error == "" && !empty($_FILES["mediafile"]["name"]) && empty($_FILES["thumbnail"]["name"])) {
     if (safe_POST('genthumb', 'yes', 'no') == 'yes') {
         // Generate thumbnail from main image
         $parts = pathinfo_utf($mediaFile);
         if (!empty($parts["extension"])) {
             $ext = strtolower($parts["extension"]);
             if (isImageTypeSupported($ext)) {
                 $thumbnail = $thumbFolderName . $mediaFile;
                 $okThumb = generate_thumbnail($folderName . $mediaFile, $thumbnail, "OVERWRITE");
                 if (!$okThumb) {
                     $error .= print_text("thumbgen_error", 0, 1);
                 } else {
                     print_text("thumb_genned");
                     print "<br />";
                     AddToLog("Media thumbnail {$thumbnail} generated");
                 }
             }
         }
     }
 }
 // Let's see if there are any errors generated and print it
 if (!empty($error)) {
Пример #2
0
    send404AndExit();
}
$mimetype = $media->mimeType();
$imgsize = $media->getImageAttributes($which);
$protocol = $_SERVER["SERVER_PROTOCOL"];
// determine if we are using HTTP/1.0 or HTTP/1.1
$filetime = $media->getFiletime($which);
$filetimeHeader = gmdate("D, d M Y H:i:s", $filetime) . ' GMT';
$expireOffset = 3600 * 24;
// tell browser to cache this image for 24 hours
if (WT_Filter::get('cb')) {
    $expireOffset = $expireOffset * 7;
}
// if cb parameter was sent, cache for 7 days
$expireHeader = gmdate("D, d M Y H:i:s", WT_TIMESTAMP + $expireOffset) . " GMT";
$type = isImageTypeSupported($imgsize['ext']);
$usewatermark = false;
// if this image supports watermarks and the watermark module is intalled...
if ($type) {
    // if this is not a thumbnail, or WATERMARK_THUMB is true
    if ($which == 'main' || $WATERMARK_THUMB) {
        // if the user’s priv’s justify it...
        if (WT_USER_ACCESS_LEVEL > $SHOW_NO_WATERMARK) {
            // add a watermark
            $usewatermark = true;
        }
    }
}
// determine whether we have enough memory to watermark this image
if ($usewatermark) {
    if (!hasMemoryForImage($serverFilename)) {