function images() { ini_set('memory_limit', '128M'); require 'include/cypher.class.php'; require 'include/timthumb/timthumb.class.php'; $ecode_str = base64_decode(str_replace(preg_split('~~u', '-_,', null, PREG_SPLIT_NO_EMPTY), preg_split('~~u', '+/=', null, PREG_SPLIT_NO_EMPTY), $this->args[0])); $cypher = new Cypher(); $cypher->key = Core::inst()->img_password; $images_param['src'] = '../view/upload/images/' . $cypher->decrypt(mb_substr($ecode_str, mb_strlen(Core::inst()->img_prefix, 'UTF-8') - mb_strlen($ecode_str, 'UTF-8'))); $this('db')->query('SELECT * FROM `di.album_gallery`, `di.album_photo` WHERE `di.album_gallery`.`album_gallery_id` = `di.album_photo`.`album_photo_gallery_id` AND `di.album_photo`.`album_photo_name` = ? AND `di.album_gallery`.`album_gallery_visible` = 1;', $cypher->decrypt(mb_substr($ecode_str, mb_strlen(Core::inst()->img_prefix, 'UTF-8') - mb_strlen($ecode_str, 'UTF-8')))); if ($this('db')->affected_rows() == 0) { exit(0); } if (isset($this->args[1]) && $this->args[1] != 0) { $images_param['w'] = $this->args[1]; } if (isset($this->args[2]) && $this->args[2] != 0) { $images_param['h'] = $this->args[2]; } $images_param['q'] = 100; timthumb::start($images_param); }
if (!defined('WEBSHOT_PROXY')) { define('WEBSHOT_PROXY', ''); } //In case you're behind a proxy server. if (!defined('WEBSHOT_XVFB_RUNNING')) { define('WEBSHOT_XVFB_RUNNING', false); } //ADVANCED: Enable this if you've got Xvfb running in the background. // If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains. if (!isset($ALLOWED_SITES)) { $ALLOWED_SITES = array('flickr.com', 'staticflickr.com', 'picasa.com', 'img.youtube.com', 'upload.wikimedia.org', 'photobucket.com', 'imgur.com', 'imageshack.us', 'tinypic.com'); } // ------------------------------------------------------------- // -------------- STOP EDITING CONFIGURATION HERE -------------- // ------------------------------------------------------------- timthumb::start(); class timthumb { protected $src = ""; protected $is404 = false; protected $docRoot = ""; protected $lastURLError = false; protected $localImage = ""; protected $localImageMTime = 0; protected $url = false; protected $myHost = ""; protected $isURL = false; protected $cachefile = ''; protected $errors = array(); protected $toDeletes = array(); protected $cacheDirectory = '';
/** * * Render resized image * @param string $image * @param int $width * @param int $height * @return string image */ function renderImage($image, $width = 0, $height = 0) { if ($image) { if ($this->params->get('thumbnailmode', 1)) { $timthumb_params = array(); if (preg_match('/^https?:\\/\\/[^\\/]+/i', $image)) { $timthumb_params['src'] = $image; } else { $timthumb_params['src'] = JURI::Base() . $image; } $timthumb_params['w'] = $width; $timthumb_params['h'] = $height; $timthumb_params['q'] = $this->params->get('imagequality', '90'); $timthumb_params['a'] = $this->params->get('alignment', 'c'); $timthumb_params['zc'] = $this->params->get('zoomcrop', '1'); if ($this->params->get('customfilters', '') != '') { $timthumb_params['f'] = $this->params->get('customfilters', ''); } else { $filters = $this->params->get('filters'); if (!empty($filters)) { $filters = implode("|", $filters); $timthumb_params['f'] = $filters; } } $timthumb_params['s'] = $this->params->get('sharpen', '0'); $timthumb_params['cc'] = $this->params->get('canvascolour', 'FFFFFF'); $timthumb_params['ct'] = $this->params->get('canvastransparency', '1'); $tb_image = timthumb::start($timthumb_params); // If can resize image -> return resized image, else keep original image if (trim($tb_image) != '') { $image = $tb_image; } return $image; } else { return $image; } } else { return ''; } }