Created
January 26, 2015 14:38
-
-
Save bastianallgeier/1e7123c904d480593c7b to your computer and use it in GitHub Desktop.
Thumbnail destinations with page structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
c::set('thumbs.destination', function($thumb) { | |
$page = $thumb->source->page(); | |
$filename = $thumb->source->name() . '-' . $thumb->settingsIdentifier() . '.' . $thumb->source->extension(); | |
$root = $thumb->options['root'] . DS . str_replace('/', DS, $page->uri()) . DS . $filename; | |
$url = $thumb->options['url'] . '/' . $page->uri() . '/' . $filename; | |
// create the directory | |
dir::make(dirname($root)); | |
return new Obj(array( | |
'url' => $url, | |
'root' => $root | |
)); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment