コード例 #1
0
         } else {
             die('File download failed!');
         }
     } else {
         die("File cannot be found at link provided.");
     }
 } else {
     // Do resizing and downloading
     $imgPath = "{$folderPath}/originals/{$mediaInfo[filename]}";
 }
 try {
     $mediaImage = new imagetools($imgPath);
     $mediaImage->setQuality(100);
     //$mediaImage->setCrop($crop);
     //$mediaImage->setHCrop($hcrop);
     $mediaImage->setSize($width);
     $mediaImage->setWidth($width);
     $mediaImage->setHeight($height);
     //$mediaImage->setSharpen($sharpen);
     $mediaImage->setWatermark($digital['watermark']);
     $mediaImage->createImage(0, $tmpFilenamePath);
 } catch (Exception $e) {
     die(exceptionError($e));
 }
 //$file = "./assets/tmp/{$tmpFilename}";
 $ctype = "application/txt";
 if (!file_exists($tmpFilenamePath)) {
     die("Error 3: This file cannot be found on the server.");
 }
 $downloadFilename = basefilename($mediaInfo['ofilename']) . ".jpg";
 header("Content-Type: {$ctype}");
コード例 #2
0
ファイル: avatar.php プロジェクト: spencerlambert/willie-php
/*
 * Convert to global variables
 */
$size = $_GET['size'] ? $_GET['size'] : '100';
$quality = 90;
$memID = $_GET['memID'];
$crop = $_GET['crop'];
$hcrop = $_GET['hcrop'];
$sizeType = 'small';
if ($size > 17 and file_exists(BASE_PATH . "/assets/avatars/{$memID}_large.png")) {
    // If size setting is larger then 17 use the large size instead
    $sizeType = 'large';
}
$path = BASE_PATH . "/assets/avatars/{$memID}_{$sizeType}.png";
// Direct path to avatar file to use
if (!file_exists($path)) {
    $path = BASE_PATH . '/assets/themes/' . $config['settings']['style'] . '/images/avatar.png';
}
if (!file_exists($path)) {
    $path = BASE_PATH . "/assets/images/blank.png";
}
try {
    $avatar = new imagetools($path);
    $avatar->setQuality($quality);
    $avatar->setCrop($crop);
    $avatar->setHCrop($hcrop);
    $avatar->setSize($size);
    $avatar->createImage(1, '');
} catch (Exception $e) {
    die($e->getMessage());
}
コード例 #3
0
ファイル: upload.php プロジェクト: spencerlambert/willie-php
         $memory_limit = $config['DefaultMemory'];
     }
     # IF IMAGEMAGICK ALLOW TWEAKED MEMORY LIMIT
     if (class_exists('Imagick') and $config['settings']['imageproc'] == 2) {
         $memory_limit = $config['DefaultMemory'];
     }
     $autoCreateAvailable = 1;
 }
 //test($filenameExt);
 # CHECK TO SEE IF ONE CAN BE CREATED
 if (in_array(strtolower($filenameExt), $creatableFiletypes)) {
     # CHECK THE MEMORY NEEDED TO CREATE IT
     if ($memory_limit > $mem_needed) {
         // Create Icon
         $image = new imagetools($targetDir . $fileName);
         $image->setSize($config['IconDefaultSize']);
         $image->setQuality($config['SaveThumbQuality']);
         $image->createImage(0, $iconImage);
         // Create Thumb
         $image->setSize($config['ThumbDefaultSize']);
         $image->setQuality($config['SaveThumbQuality']);
         $image->createImage(0, $thumbImage);
         // Create Sample
         $image->setSize($config['SampleDefaultSize']);
         $image->setQuality($config['SaveSampleQuality']);
         $image->createImage(0, $sampleImage);
     } else {
         $errormessage[] = $mgrlang['not_enough_mem'];
     }
 }
 $_SESSION['contrImportFiles'][] = base64_encode($filePath);
コード例 #4
0
ファイル: image.php プロジェクト: spencerlambert/willie-php
    }
    /* // Testing
    		echo 'path: '.$path.'<br>';
    		echo 'quality: '.$quality.'<br>';
    		echo 'crop: '.$crop.'<br>';
    		echo 'hcrop: '.$hcrop.'<br>';
    		echo 'sharpen: '.$sharpen.'<br>';
    		echo 'watermark: '.$watermark.'<br>';
    		exit;
    		*/
    $mediaImage = new imagetools($path);
    $mediaImage->setQuality($quality);
    $mediaImage->setCrop($crop);
    $mediaImage->setDebugMode($_SESSION['debugMode'], $plstart);
    $mediaImage->setHCrop($hcrop);
    $mediaImage->setSize($size);
    $mediaImage->setSharpen($sharpen);
    $mediaImage->setWatermark($watermark);
    if ($_SESSION['debugMode'] or $config['cacheImages'] == 0 or $offSiteRequest) {
        $mediaImage->createImage(1, '');
    } else {
        $mediaImage->createImage(1, $cachePathFile);
    }
    // Cache
    //file_get_contents xxxxxxxxxx for reading cached file
} catch (Exception $e) {
    die($e->getMessage());
}
if ($db) {
    mysqli_close($db);
}
コード例 #5
0
/*
 * Convert to global variables
 */
$size = $_GET['size'] ? $_GET['size'] : '100';
$quality = $config['settings']['thumb_quality'];
$sharpen = $config['settings']['thumb_sharpen'];
$crop = $_GET['crop'];
$hcrop = $_GET['hcrop'];
$path = $incomingFolder . "/{$_GET[src]}";
// Direct path to product shot file to use
if (!file_exists($path)) {
    $path = BASE_PATH . "/assets/images/blank.png";
}
// echo $path; exit; // Testing
try {
    $contrImage = new imagetools($path);
    $contrImage->setQuality($quality);
    $contrImage->setCrop($crop);
    $contrImage->setHCrop($hcrop);
    $contrImage->setSize($size);
    $contrImage->setSharpen($sharpen);
    //$productShot->createImage(1,'');
    if ($_SESSION['debugMode'] or $config['cacheImages'] == 0) {
        $contrImage->createImage(1, '');
    } else {
        $contrImage->createImage(1, $cachePathFile);
    }
    // Cache
} catch (Exception $e) {
    die($e->getMessage());
}
コード例 #6
0
if ($size > 500 and file_exists(BASE_PATH . "/assets/item_photos/{$itemType}{$itemID}_ip{$photoID}_org.jpg")) {
    // If size setting is larger then 500 use the original size instead
    $sizeType = 'org';
}
// xxxxxxxxxxxxxx check to make sure of memory limit
$path = BASE_PATH . "/assets/item_photos/{$itemType}{$itemID}_ip{$photoID}_{$sizeType}.jpg";
// Direct path to product shot file to use
if (!file_exists($path)) {
    $path = BASE_PATH . "/assets/images/blank.png";
}
if ($itemType == 'gallery' and $config['settings']['gallerythumbcrop'] and !$crop) {
    // If this is a gallery icon and thumb cropping is turned on figure out the size
    $crop = $config['settings']['gallerythumbcrop_height'];
}
try {
    $productShot = new imagetools($path);
    $productShot->setQuality($quality);
    $productShot->setCrop($crop);
    $productShot->setHCrop($hcrop);
    $productShot->setSize($size);
    $productShot->setSharpen($sharpen);
    //$productShot->createImage(1,'');
    if ($_SESSION['debugMode'] or $config['cacheImages'] == 0) {
        $productShot->createImage(1, '');
    } else {
        $productShot->createImage(1, $cachePathFile);
    }
    // Cache
} catch (Exception $e) {
    die($e->getMessage());
}