/** * The index handler. * * @access public * @return string The HTML code. */ public function index() { $Assembly = new Assembly(); $params = array(); $this->getView()->set('Assemblies', $Assembly->findList($params, 'Position asc')); return $this->getView()->render(); }
<?php require_once 'imports.php'; $nut = new Part('Nut', 5); $bolt = new Part('Bolt', 9); $panel = new Part('Panel', 35); $gizmo = new Assembly('Gizmo'); $gizmo->addItem($panel); $gizmo->addItem($nut); $gizmo->addItem($bolt); $widget = new Assembly('Widget'); $widget->addItem($gizmo); $widget->addItem($nut); ?> <html> <body> <p><?php echo $nut; ?> </p> <p><?php echo $bolt; ?> </p> <p><?php echo $panel; ?> </p> <p><?php echo $gizmo; ?>
/** * Callback functions for transloadit proccessor * * * @return Response */ public function notify() { $response = json_decode(Input::get('transloadit')); @($a = Assembly::where('assembly', '=', $response->assembly_id)->first()); if ($a) { $s = Song::find($a->song); /// Processing big image $image = $response->results->waveform[0]->url; $imgs3 = file_get_contents($image); file_put_contents($s->path . "/thumbnail" . ".png", $imgs3); // Processing mp3 $duration = $response->results->waveform[0]->meta->duration; $mp3name = substr(md5(microtime()), 0, 150); $s->sample = $mp3name; $duration = number_format($duration, 2); $s->duration = $duration; $s->save(); $mp3 = $response->results->mp3[0]->url; $dsong = file_get_contents($mp3); file_put_contents($s->path . "/" . $mp3name . ".mp3", $dsong); $a->delete(); } return Response::json('success', 200); }