C:\wwwroot\reichwein-weimar.de\kirby\vendor\getkirby\toolkit\vendors\abeautifulsite\SimpleImage.php
* Where red, green, blue - integers 0-255, alpha - integer 0-127<br>
* (is used for creating image from scratch)
*
* @throws Exception
*
*/
public function __construct($filename = null, $width = null, $height = null, $color = null) {
if ($filename !== null) {
$this->load($filename);
} elseif ($width !== null) {
$this->create($width, $height, $color);
}
}
/**
* Destroy image resource
*
*/
public function __destruct() {
if( get_resource_type($this->image) === 'gd' ) {
imagedestroy($this->image);
}
}
/**
* Adaptive resize
*
* This function has been deprecated and will be removed in an upcoming release. Please
* update your code to use the `thumbnail()` method instead. The arguments for both
* methods are exactly the same.
*
* @param int $width
* @param int|null $height If omitted - assumed equal to $width
*
* @return SimpleImage
*
*/
public function adaptive_resize($width, $height = null) {
return $this->thumbnail($width, $height);
C:\wwwroot\reichwein-weimar.de\kirby\vendor\getkirby\toolkit\vendors\abeautifulsite\SimpleImage.php
* Where red, green, blue - integers 0-255, alpha - integer 0-127<br>
* (is used for creating image from scratch)
*
* @throws Exception
*
*/
public function __construct($filename = null, $width = null, $height = null, $color = null) {
if ($filename !== null) {
$this->load($filename);
} elseif ($width !== null) {
$this->create($width, $height, $color);
}
}
/**
* Destroy image resource
*
*/
public function __destruct() {
if( get_resource_type($this->image) === 'gd' ) {
imagedestroy($this->image);
}
}
/**
* Adaptive resize
*
* This function has been deprecated and will be removed in an upcoming release. Please
* update your code to use the `thumbnail()` method instead. The arguments for both
* methods are exactly the same.
*
* @param int $width
* @param int|null $height If omitted - assumed equal to $width
*
* @return SimpleImage
*
*/
public function adaptive_resize($width, $height = null) {
return $this->thumbnail($width, $height);
C:\wwwroot\reichwein-weimar.de\kirby\vendor\getkirby\toolkit\lib\thumb.php
if($this->options['overwrite'] === true) return false;
// try to use the original if resizing is not necessary
if($this->options['width'] >= $this->source->width() &&
$this->options['height'] >= $this->source->height() &&
$this->options['crop'] == false &&
$this->options['blur'] == false &&
$this->options['upscale'] == false) return true;
return false;
}
/**
* Calls the driver function and
* creates the thumbnail
*/
protected function create() {
return call_user_func_array(static::$drivers[$this->options['driver']], array($this));
}
/**
* Makes all public methods of the result object
* available to the thumb class
*
* @param string $method
* @param mixed $arguments
* @return mixed
*/
public function __call($method, $arguments) {
if(method_exists($this->result, $method)) {
return call_user_func_array(array($this->result, $method), $arguments);
}
}
/**
* Generates and returns the full html tag for the thumbnail
C:\wwwroot\reichwein-weimar.de\kirby\vendor\getkirby\toolkit\lib\thumb.php
if($this->isObsolete()) return;
// don't create the thumbnail if it exists
if(!$this->isThere()) {
// try to create the thumb folder if it is not there yet
dir::make(dirname($this->destination->root));
// check for a valid image
if(!$this->source->exists() || $this->source->type() != 'image') {
throw new Error('The given image is invalid', static::ERROR_INVALID_IMAGE);
}
// check for a valid driver
if(!array_key_exists($this->options['driver'], static::$drivers)) {
throw new Error('Invalid thumbnail driver', static::ERROR_INVALID_DRIVER);
}
// create the thumbnail
$this->create();
// check if creating the thumbnail failed
if(!file_exists($this->destination->root)) return;
}
// create the result object
$this->result = new Media($this->destination->root, $this->destination->url);
}
/**
* Build the destination object
*
* @return Obj
*/
public function destination() {
if(is_callable($this->options['destination'])) {
return call($this->options['destination'], $this);
C:\wwwroot\reichwein-weimar.de\kirby\kirby\component\thumb.php
}
// load a thumb preset
$presets = $this->kirby->option('thumbs.presets');
if(is_string($params)) {
if(isset($presets[$params])) {
$params = $presets[$params];
} else {
throw new Error('Invalid thumb preset ' . $params);
}
} else if($params === []) {
// try to load the default preset
// otherwise use the thumb defaults from the Toolkit
if(isset($presets['default'])) {
$params = $presets['default'];
}
}
// generate the thumb
$thumb = new Generator($file, $params);
$asset = new Asset($thumb->result);
// store a reference to the original file
$asset->original($file);
return $thumb->exists() ? $asset : $file;
}
/**
* Returns the clean path for a thumbnail
*
* @param Generator $thumb
* @return string
*/
protected function path(Generator $thumb) {
return ltrim($this->dir($thumb) . '/' . $this->filename($thumb), '/');
}
/**
C:\wwwroot\reichwein-weimar.de\kirby\kirby\traits\image.php
if($original === null) {
return $this->original;
} else {
$this->original = $original;
return $this;
}
}
/**
* Creates a thumbnail for the image
*
* @param array $params
* @return Asset
*/
public function thumb($params = []) {
// don't scale thumbs further down
if($this->original()) {
throw new Exception('Thumbnails cannot be modified further');
} else {
return $this->kirby->component('thumb')->create($this, $params);
}
}
/**
* Scales the image if possible
*
* @param int $width
* @param mixed $height
* @param mixed $quality
* @return Asset
*/
public function resize($width, $height = null, $quality = null) {
$params = ['width' => $width];
if($height) $params['height'] = $height;
if($quality) $params['quality'] = $quality;
return $this->thumb($params);
C:\wwwroot\reichwein-weimar.de\kirby\helpers.php
$page = $uri == '/' ? site() : page($uri);
if($page) {
return $page->image($filename);
} else {
return null;
}
}
/**
* Shortcut to create a new thumb object
*
* @param mixed Either a file path or a Media object
* @param array An array of additional params for the thumb
* @return object Thumb
*/
function thumb($image, $params = array(), $obj = true) {
if(is_a($image, 'File') || is_a($image, 'Asset')) {
return $obj ? $image->thumb($params) : $image->thumb($params)->url();
} else {
$class = new Thumb($image, $params);
return $obj ? $class : $class->url();
}
}
C:\wwwroot\reichwein-weimar.de\site\templates\referenz01.php
</div>
<!-- Bereich Text oben -->
<div class="row bgr04">
<div class="seite">
<div class="large-5 columns disoben04 text">
<h6>Projekt</h6>
<?php echo $page->text()->kirbytext() ?>
<h6>Ausführung:</h6>
<?php echo $page->Datum()->kirbytext() ?>
<h6>Leistung:</h6>
<?php echo $page->Leistung()->kirbytext() ?>
</div>
</div>
</div>
<!-- Bereich Bilder -->
<div class="row bgr04">
<div class="seite">
<div class="large-5 middle-5 small-1 columns disoben04 disunten06 ">
<?php foreach($page->images()->sortBy('sort', 'asc') as $image): ?>
<a href="<?php echo $image->url() ?>" rel="lightbox[1]" > <img class="referenzbild" src="<?php echo thumb($image, array('width' => 300, 'height' => 300, 'crop' => true))->url();?>" alt="<?php echo $page->title()->html() ?>"/> </a>
<?php endforeach ?>
</div>
</div>
</div>
</main>
<?php snippet('footer') ?>
C:\wwwroot\reichwein-weimar.de\kirby\vendor\getkirby\toolkit\lib\tpl.php
/**
* Tpl
*
* Super simple template engine
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link http://getkirby.com
* @copyright Bastian Allgeier
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
class Tpl extends Silo {
public static $data = array();
public static function load($_file, $_data = array(), $_return = true) {
if(!file_exists($_file)) return false;
ob_start();
extract(array_merge(static::$data, (array)$_data));
require($_file);
$_content = ob_get_contents();
ob_end_clean();
if($_return) return $_content;
echo $_content;
}
}
C:\wwwroot\reichwein-weimar.de\kirby\kirby\component\template.php
if($template instanceof Page) {
$page = $template;
$file = $page->templateFile();
$data = $this->data($page, $data);
} else {
$file = $template;
$data = $this->data(null, $data);
}
// check for an existing template
if(!file_exists($file)) {
throw new Exception('The template could not be found');
}
// merge and register the template data globally
$tplData = tpl::$data;
tpl::$data = array_merge(tpl::$data, $data);
// load the template
$result = tpl::load($file, null, $return);
// reset the template data
tpl::$data = $tplData;
return $result;
}
}
C:\wwwroot\reichwein-weimar.de\kirby\kirby.php
}
return $template;
}
// return a fresh template
return $this->template($page, $data);
}
/**
* Template configuration
*
* @param Page $page
* @param array $data
* @return string
*/
public function template(Page $page, $data = array()) {
return $this->component('template')->render($page, $data);
}
public function request() {
if(!is_null($this->request)) return $this->request;
return $this->request = new Request($this);
}
public function router() {
return $this->router;
}
public function route() {
return $this->route;
}
/**
* Starts the router, renders the page and returns the response
*
* @return mixed
*/
C:\wwwroot\reichwein-weimar.de\kirby\kirby.php
}
}
// try to fetch the template from cache
$template = $this->cache()->get($cacheId);
// fetch fresh content if the cache is empty
if(empty($template)) {
$template = $this->template($page, $data);
// store the result for the next round
$this->cache()->set($cacheId, $template);
}
return $template;
}
// return a fresh template
return $this->template($page, $data);
}
/**
* Template configuration
*
* @param Page $page
* @param array $data
* @return string
*/
public function template(Page $page, $data = array()) {
return $this->component('template')->render($page, $data);
}
public function request() {
if(!is_null($this->request)) return $this->request;
return $this->request = new Request($this);
}
public function router() {
C:\wwwroot\reichwein-weimar.de\kirby\kirby\component\response.php
* @link http://getkirby.com
* @copyright Bastian Allgeier
* @license http://getkirby.com/license
*/
class Response extends \Kirby\Component {
/**
* Builds and return the response by various input
*
* @param mixed $response
* @return mixed
*/
public function make($response) {
if(is_string($response)) {
return $this->kirby->render(page($response));
} else if(is_array($response)) {
return $this->kirby->render(page($response[0]), $response[1]);
} else if(is_a($response, 'Page')) {
return $this->kirby->render($response);
} else if(is_a($response, 'Response')) {
return $response;
} else {
return null;
}
}
}
C:\wwwroot\reichwein-weimar.de\kirby\kirby.php
// check for a valid route
if(is_null($this->route)) {
header::status('500');
header::type('json');
die(json_encode(array(
'status' => 'error',
'message' => 'Invalid route or request method'
)));
}
// call the router action with all arguments from the pattern
$response = call($this->route->action(), $this->route->arguments());
// load all language variables
// this can only be loaded once the router action has been called
// otherwise the current language is not yet available
$this->localize();
// build the response
$this->response = $this->component('response')->make($response);
// store the current language in the session
if(
$this->option('language.detect') &&
$this->site()->multilang() &&
$this->site()->language()
) {
s::set('kirby_language', $this->site()->language()->code());
}
return $this->response;
}
/**
* Register a new hook
*
* @param string/array $hook The name of the hook
* @param closure $callback
*/
C:\wwwroot\reichwein-weimar.de\index.php
<?php
define('DS', DIRECTORY_SEPARATOR);
// load kirby
require(__DIR__ . DS . 'kirby' . DS . 'bootstrap.php');
// check for a custom site.php
if(file_exists(__DIR__ . DS . 'site.php')) {
require(__DIR__ . DS . 'site.php');
} else {
$kirby = kirby();
}
// render
echo $kirby->launch();