MDL-31901 repositories serving images from the filepool now provide preview details

This commit is contained in:
David Mudrak 2012-05-10 06:12:24 +02:00 committed by Marina Glancy
parent 0dbf6c88bb
commit dfad252c9e
4 changed files with 29 additions and 0 deletions

View File

@ -124,6 +124,13 @@ class repository_coursefiles extends repository {
'source'=> $encodedpath,
'thumbnail' => $OUTPUT->pix_url(file_extension_icon($child->get_visible_name(), 32))->out(false)
);
if ($imageinfo = $child->get_imageinfo()) {
$fileurl = new moodle_url($child->get_url());
$node['realthumbnail'] = $fileurl->out(false, array('preview' => 'thumb'));
$node['realicon'] = $fileurl->out(false, array('preview' => 'tinyicon'));
$node['image_width'] = $imageinfo['width'];
$node['image_height'] = $imageinfo['height'];
}
$list[] = $node;
}
}

View File

@ -221,6 +221,14 @@ class repository_local_file {
$node['license'] = $this->fileinfo->get_license();
$node['source'] = $encodedpath;
$node['thumbnail'] = $OUTPUT->pix_url(file_extension_icon($node['title'], 32))->out(false);
if ($imageinfo = $this->fileinfo->get_imageinfo()) {
// what a beautiful picture, isn't it
$fileurl = new moodle_url($this->fileinfo->get_url());
$node['realthumbnail'] = $fileurl->out(false, array('preview' => 'thumb'));
$node['realicon'] = $fileurl->out(false, array('preview' => 'tinyicon'));
$node['image_width'] = $imageinfo['width'];
$node['image_height'] = $imageinfo['height'];
}
}
return $node;
}

View File

@ -132,6 +132,13 @@ class repository_recent extends repository {
'source'=> $params,
'thumbnail' => $OUTPUT->pix_url(file_extension_icon($file['filename'], 32))->out(false),
);
if ($imageinfo = $fileinfo->get_imageinfo()) {
$fileurl = new moodle_url($fileinfo->get_url());
$node['realthumbnail'] = $fileurl->out(false, array('preview' => 'thumb'));
$node['realicon'] = $fileurl->out(false, array('preview' => 'tinyicon'));
$node['image_width'] = $imageinfo['width'];
$node['image_height'] = $imageinfo['height'];
}
$list[] = $node;
}
}

View File

@ -115,6 +115,13 @@ class repository_user extends repository {
'source'=> $encodedpath,
'thumbnail' => $OUTPUT->pix_url(file_extension_icon($child->get_visible_name(), 32))->out(false)
);
if ($imageinfo = $child->get_imageinfo()) {
$fileurl = new moodle_url($child->get_url());
$node['realthumbnail'] = $fileurl->out(false, array('preview' => 'thumb'));
$node['realicon'] = $fileurl->out(false, array('preview' => 'tinyicon'));
$node['image_width'] = $imageinfo['width'];
$node['image_height'] = $imageinfo['height'];
}
$list[] = $node;
}
}