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
public function getImage($name){ | |
$folder_path = '/physical/path/to/file/'; | |
$image_path = $folder_path.$name; | |
$filetype = pathinfo($image_path, PATHINFO_EXTENSION); | |
if (file_exists($image_path)) { | |
$file_data = file_get_contents($image_path); | |
return 'data:image/' . $filetype . ';base64,' . base64_encode($file_data); | |
} | |
} |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
files: { | |
grunt: ['Gruntfile.js'], | |
js: ['javascripts/foundation/jquery.js', | |
'javascripts/**/*.js', | |
'javascripts/*.js', |
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
function explore_recursive($path) { | |
$contents = glob($path .'*', GLOB_BRACE); | |
if (count($contents) > 0) { | |
foreach ($contents as $item) { | |
$file['name'] = basename($item); | |
// $file['location'] = $item; | |
$found = explore_recursive($item . '/'); | |
if ($found) { $file['contents'] = $found; } | |
$branch[] = $file; | |
} |
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 | |
class Core_Base | |
{ | |
/** | |
* the constructor will assign | |
* - the values specified in the constructor's arguments, in that specific order as the object's properties | |
* - if an array is passed as argument, the values from that array will be passed as the object's properties | |
* - the object's properties which have no value assigned will be set to false to prevent name collisions in the mustache templates | |
*/ |
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 | |
class AdminRedactorController extends AdminController { | |
private $publicFolder = 'redactor_uploads'; | |
private $uploadFolder = 'public/' . $publicFolder; | |
public function fileUpload(){ |
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 | |
class DropzoneController extends BaseController { | |
public function upload() { | |
$r = Util::uploadUnique('file', Config::get('website.dropzone_uploads')); | |
extract($r); | |
//return response |
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 | |
class ImageResizeController extends BaseController { | |
/** | |
* This method catches urls like /imagecache/width/height/path/to/original_image.jpg and | |
* creates the image if public/imagecache/width/height/path/to/original_image.jpg doesn't exist. | |
* | |
* Urls like this are used for returning a resized version of /path/to/original_image.jpg |
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
// disable :hover on touch devices | |
// based on https://gist.github.com/4404503 | |
// via https://twitter.com/javan/status/284873379062890496 | |
// + https://twitter.com/pennig/status/285790598642946048 | |
// re http://retrogamecrunch.com/tmp/hover | |
// NOTE: we should use .no-touch class on CSS | |
// instead of relying on this JS code | |
function removeHoverCSSRule() { | |
if ('createTouch' in document) { | |
try { |
OlderNewer