Skip to content

Commit

Permalink
MDL-31901 repositories serving images from the filepool now provide p…
Browse files Browse the repository at this point in the history
…review details
  • Loading branch information
mudrd8mz authored and marinaglancy committed May 21, 2012
1 parent 0dbf6c8 commit dfad252
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions repository/coursefiles/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ public function get_listing($encodedpath = '', $page = '') {
'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;
}
}
Expand Down
8 changes: 8 additions & 0 deletions repository/local/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@ public function get_node() {
$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;
}
Expand Down
7 changes: 7 additions & 0 deletions repository/recent/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ public function get_listing($encodedpath = '', $page = '') {
'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;
}
}
Expand Down
7 changes: 7 additions & 0 deletions repository/user/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ public function get_listing($encodedpath = '', $page = '') {
'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;
}
}
Expand Down

0 comments on commit dfad252

Please sign in to comment.