Example #1
0
function smarty_block_thumbnail($params, $content, &$smarty, &$repeat)
{
    if (isset($content)) {
        $thumb = new cf\Thumbnail($content, $params['width'], $params['height']);
        return $thumb->url();
    }
}
Example #2
0
function getThumbnail($path, $width, $height)
{
    if (!$path) {
        return '';
    }
    \cf\Image::$USE_IMAGEMAGICK = \cf\Config::use_imagemagick;
    $thumb = new \cf\Thumbnail($_SERVER['DOCUMENT_ROOT'] . '/' . $path, $width, $height);
    return $thumb->url();
}
Example #3
0
<?php

require_once dirname(__FILE__) . '/cf/config.php';
require_once cf\Config::path . 'image.php';
require_once cf\Config::path . 'shop.php';
$product = new cf\Product($_REQUEST['p']);
$images = $product->images();
$path = $images[array_key_exists('i', $_REQUEST) ? $_REQUEST['i'] : 0];
$thumb = new cf\Thumbnail(cf\Config::root_path . $path, 391, 358);
$fpath = $thumb->path();
$img = cf\Image::loadFromFile($fpath);
$watermark = cf\Image::loadFromFile(cf\Config::root_path . 'images/logo_white.png');
$watermark->setColorTransparentAsAt(1, 2);
$img->putWatermark($watermark, 60, ($img->width() - $watermark->width()) / 2, $img->height() - $watermark->height());
header('content-type: ' . cf\Image::getImageMime($fpath));
$img->output(cf\Image::getImageType($fpath));