Issue 133: Add lazy loading for images support

This commit is contained in:
Nathan Adams
2016-03-05 21:32:34 -06:00
parent b8d6c17308
commit 57641e1661
9 changed files with 85 additions and 5 deletions

View File

@@ -32,7 +32,7 @@ Pluf::loadFunction('Pluf_Shortcuts_GetFormForModel');
class IDF_Views_Project
{
/**
* Home page of a project.
* Logo of a project.
*/
public $logo_precond = array('IDF_Precondition::baseAccess');
public function logo($request, $match)
@@ -52,6 +52,25 @@ class IDF_Views_Project
$info[0]);
}
/**
* Logo of a project.
*/
public $logo64_precond = array('IDF_Precondition::baseAccess');
public function logo64($request, $match)
{
$prj = $request->project;
$logo = $prj->getConf()->getVal('logo');
if (empty($logo)) {
$file = "./media/idf/img/no_logo.png";
$info = IDF_FileUtil::getMimeType($file);
return new Pluf_HTTP_Response("data:" . $info[0] . ";base64," . base64_encode(file_get_contents($file)), "text/text");
}
$info = IDF_FileUtil::getMimeType($logo);
return new Pluf_HTTP_Response("data:" . $info[0] . ";base64," . base64_encode(file_get_contents(Pluf::f('upload_path') . '/' . $prj->shortname . $logo)), "text/text");
}
/**
* Home page of a project.
*/