Exemple #1
0
function the_php_thumb($src, $width, $height, $crop = true, $quality = 70)
{
    $url = parse_url($src);
    $pars = 'src=' . $url['path'];
    $pars .= '&w=' . $width . '&h=' . $height;
    if ($crop) {
        $pars .= '&zc=true';
    }
    $pars .= '&q=' . $quality;
    return '<img src="' . htmlentities(phpThumbURL($pars, get_stylesheet_directory_uri() . '/phpthumb/phpThumb.php')) . '">';
}
Exemple #2
0
 protected function render($param = null)
 {
     $pkg = self::get_pkg();
     $size = $this->size;
     if (isset($param[0])) {
         $size = $param[0];
     }
     if (preg_match('/\\.swf$/i', $this->attr['src'])) {
         return $this->render_flash($pkg, $size);
     }
     if (isset($pkg->config['thumb_sizes'][$size])) {
         $attr_save = $this->attr;
         $sz = $pkg->config['thumb_sizes'][$size];
         unset($this->attr['width']);
         unset($this->attr['height']);
         if (isset($sz['w'])) {
             $this->attr['width'] = $sz['w'];
         }
         if (isset($sz['h'])) {
             $this->attr['height'] = $sz['h'];
         }
         if ($this->set_thumb_size && isset($this->width) && isset($this->height)) {
             if (!isset($this->attr['width']) && isset($sz['h'])) {
                 $thumb_w = floor($this->width * ($sz['h'] / $this->height));
                 $this->attr['width'] = $thumb_w;
             }
             if (!isset($this->attr['height']) && isset($sz['w'])) {
                 $thumb_h = floor($this->height * ($sz['w'] / $this->width));
                 $this->attr['height'] = $thumb_h;
             }
         }
         $phpthumb = $pkg->config['phpthumb_url'];
         // display thumbnails using phpThumb if availiable
         if ((function_exists('phpThumbURL') || !empty($phpthumb)) && !preg_match('/\\.gif$/i', $this->attr['src'])) {
             $pt_param = '';
             foreach ($sz as $k => $v) {
                 $pt_param .= "&{$k}={$v}";
             }
             if (function_exists('phpThumbURL')) {
                 $this->attr['src'] = phpThumbURL('src=' . urlencode($this->attr['src']) . $pt_param);
             } else {
                 $this->attr['src'] = $phpthumb . '?src=' . urlencode($this->attr['src']) . $pt_param;
             }
         }
         $res = parent::render();
         $this->attr = $attr_save;
         return $res;
     }
     return parent::render();
 }
$Examples[] = array('getstrings' => array('src=' . $img['wmf'] . '&w=300'), 'description' => 'WMF source, width=300px' . $only_im);
$Examples[] = array('getstrings' => array('src=' . $img['pdf'] . '&w=300'), 'description' => 'PDF source, width=300px' . $only_im . $only_gs);
//$Examples[] = array('getstrings' => array(''), 'description' => '');
foreach ($Examples as $key => $ExamplesArray) {
    echo '<a href="#" name="x' . $key . '" title="click to get URL link for example #' . $key . '" onClick="prompt(\'Here is the link to example #' . $key . '\', \'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '#x' . $key . '\'); return false;">#' . $key . '</a>';
    echo '<table border="0"><tr><td style="padding: 20px; background-image: url(../' . $img['background'] . ');">';
    $text = '';
    foreach ($ExamplesArray['getstrings'] as $dummy => $GETstring) {
        if ($GETstring == "\n") {
            echo '<br>';
            $text .= "\n";
        } else {
            //echo '<a href="'.htmlentities($GETstring.'&down=phpThumb.demo.'.$key.'.'.$dummy).'.jpg" title="'.htmlentities($GETstring, ENT_QUOTES).'">';
            echo '<img border="0" src="' . htmlentities(phpThumbURL($GETstring, $phpThumbBase), ENT_QUOTES) . '" alt="">';
            //echo '</a> ';
            $text .= '<img border="0" src="' . htmlentities(phpThumbURL($GETstring, $phpThumbBase), ENT_QUOTES) . '" alt="">' . "\n";
        }
    }
    echo '</td></tr></table>';
    echo '<pre>' . htmlentities($text) . '</pre>';
    echo $ExamplesArray['description'] . '<br>';
    echo '<br><br><hr size="1">';
}
$PATH_INFO_examples = array('fltr[]=sep;200x200;' . $img['portrait'], 'f=png;fltr[]=wmt|hello;fltr[]=flip|y;fltr[]=wmt|hello;200x100;new=FF00FF');
echo '<a href="#" name="pathinfo" title="click to get URL link for PATH_INFO example" onClick="prompt(\'Here is the link to the PATH_INFO example\', \'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '#pathinfo\'); return false;">#pathinfo</a>';
echo '<table border="0"><tr><td style="padding: 20px; background-image: url(../' . $img['background'] . ');">';
foreach ($PATH_INFO_examples as $key => $value) {
    echo ' <img src="' . htmlentities($phpThumbBase . '/' . $value, ENT_QUOTES) . '" alt=""> ';
}
echo '</td></tr></table>';
echo '<pre>';
{
    return get_magic_quotes_gpc() ? stripslashes($string) : $string;
}
require_once '../phpThumb.config.php';
$additionalparameters = array();
foreach ($_GET as $key => $value) {
    if (is_array($value)) {
        foreach ($value as $key2 => $value2) {
            $additionalparameters[] = $key . '[]=' . SafeStripSlashes($value2);
        }
    } else {
        $additionalparameters[] = $key . '=' . SafeStripSlashes($value);
    }
}
//$imagesrc = $phpThumbLocation.implode('&', $additionalparameters);
$imagesrc = phpThumbURL(implode($PHPTHUMB_CONFIG['config_high_security_url_separator'], $additionalparameters), $phpThumbLocation);
echo '<script type="text/javascript">';
echo 'var ns4;';
echo 'var op5;';
echo 'function setBrowserWindowSizeToImage() {';
echo 'if (!document.getElementById("imageimg")) { return false; }';
echo 'sniffBrowsers();';
echo 'var imageW = getImageWidth("imageimg");';
echo 'var imageH = getImageHeight("imageimg");';
// check for maximum dimensions to allow no-scrollbar window
echo 'if (((screen.width * 1.1) > imageW) || ((screen.height * 1.1) > imageH)) {' . "\n";
// screen is large enough to fit whole picture on screen with 10% margin
echo 'CrossBrowserResizeInnerWindowTo(imageW, imageH);' . "\n";
echo '} else {' . "\n";
// image is too large for screen: add scrollbars by putting the image inside an IFRAME
echo 'document.getElementById("showpicspan").innerHTML = "<iframe width=\\"100%\\" height=\\"100%\\" marginheight=\\"0\\" marginwidth=\\"0\\" frameborder=\\"0\\" scrolling=\\"on\\" src=\\"' . $imagesrc . '\\">Your browser does not support the IFRAME tag. Please use one that does (IE, Firefox, etc).<br><img src=\\"' . $imagesrc . '\\"><\\/iframe>";';
<?php

require __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'setting.php';
$clean = filter_input_array(INPUT_GET, array('CKEditorFuncNum' => FILTER_VALIDATE_INT));
$clean['upload'] = check_file($_FILES['upload']);
move_file($clean['upload'], 'ckeditor', $_SESSION['USER_ID']);
require WEBROOT_DIRECTORY . DIRECTORY_SEPARATOR . 'phpThumb' . DIRECTORY_SEPARATOR . 'phpThumb.config.php';
$url = htmlspecialchars(phpThumbURL('src=/../uploads/ckeditor/' . $_SESSION['USER_ID'] . '/' . $clean['upload']['name'] . '&w=400&h=300', '/phpThumb/phpThumb.php'));
echo '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(' . $clean['CKEditorFuncNum'] . ',"' . $url . '","' . $clean['CKEditorFuncNum'] . '")</script>';