Skip to content

Instantly share code, notes, and snippets.

View bastianallgeier's full-sized avatar
🎯
Focusing

Bastian Allgeier bastianallgeier

🎯
Focusing
View GitHub Profile
<?php
// resize an image by the width
$image->resize($width)->url();
// resize by width and height. The bigger one will be downscaled
$image->resize($width, $height)->url();
// adjust the jpeg compression
$image->resize($width, $height, $quality)->url();
@bastianallgeier
bastianallgeier / kirby-changelog-2.2.md
Last active October 20, 2015 13:14
Kirby Changelog for 2.2

Panel

  • Rewritten architecture. Instead of a js-based router/controller architecture, the panel now uses plain server-rendered views and speeds them up with Pjax for a more reliable solution in case of js issues.
  • New static sidebar for a better user experience while editing content
  • Context menus for files and pages for easier editing and administration in the sidebar
  • A beautiful new unified search for pages and users
  • A new "style: table" option for structure fields, which will turn the display of entries into a nice table
  • A new "modalsize: small|medium|large" option for structure fields, which helps to control the width of structure modals
  • Far better user experience for file uploads. Files can now be dragged directly into the browser in the file views and on in page forms.
  • Custom user form fields with new user blueprints. You can now add a blueprint per role to site/blueprints/users (i.e. site/blueprints/users/admin.yml) and set additional custom fields there for each role. They will be adde
<?php foreach($articles as $article): ?>
<article>
<a href="<?php echo $article->url() ?>">
<h1><?php echo $article->title()->html() ?></h1>
<?php if($image = $article->image('cover.jpg')): ?>
<figure>
<img src="<?php echo $image->url() ?>" alt="">
</figure>
<?php endif ?>

Keybase proof

I hereby claim:

  • I am bastianallgeier on github.
  • I am bastianallgeier (https://keybase.io/bastianallgeier) on keybase.
  • I have a public key whose fingerprint is 90BD 230B 5676 B805 8D9A 30B1 067C 1D1A 2864 D6C3

To claim this, I am signing this object:

<?php
$page->children()->filter(function($page) {
return ($page->template() == 'article.text' or $page->template() == 'article.video');
});
<?php
c::set('routes', array(
array(
'pattern' => 'post',
'method' => 'POST',
'action' => function() {
if(get('token') != 'your-very-long-auth-token') {
return response::error('Unauthorized');
<?php
class KirbyExtended extends Kirby {
// your stuff
}
$kirby = kirby('KirbyExtended');
<?php
kirby::$handlers['template'] = function($kirby, $page, $data = array()) {
require_once(__DIR__ . DS . 'vendor' . DS . 'autoload.php');
$loader = new Twig_Loader_Filesystem($kirby->roots()->templates());
$twig = new Twig_Environment($loader, array(
'cache' => false
));
<img src="<?php $page->image()->crop(300, 200)->url() ?>" alt="Cropped by width and height">
<img src="<?php $page->image()->crop(300)->url() ?>" alt="Cropped box">
<img src="<?php $page->image()->resize(300, 200)->url() ?>" alt="Resized by width and height">
<img src="<?php $page->image()->resize(300)->url() ?>" alt="Resized by width only">
<img src="<?php $page->image()->resize(false, 200)->url() ?>" alt="Resized by height only">
@bastianallgeier
bastianallgeier / kirby-2.1-changelog.md
Created March 31, 2015 15:33
Kirby 2.1 beta changelog

Kirby 2.1 Beta

Panel

Improved Structure field

Modals

A lot of you werent happy with the current state of structure modals. They were simply too small. All modals now adapt to the screen size and if the window gets too small, modals become scrollable, avoiding any usability issues.