Merge branch 'MDL-38261-workshop-attachments-size' of git://github.com/mudrd8mz/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2013-03-05 00:48:47 +01:00
commit cdbbd48a66
3 changed files with 16 additions and 3 deletions

View File

@ -334,6 +334,9 @@ class file_storage {
} else if ($mode === 'thumb') {
$data = generate_image_thumbnail($tmpfilepath, 90, 90);
} else if ($mode === 'bigthumb') {
$data = generate_image_thumbnail($tmpfilepath, 250, 250);
} else {
throw new file_exception('storedfileproblem', 'Invalid preview mode requested');
}

View File

@ -797,8 +797,11 @@ class mod_workshop_renderer extends plugin_renderer_base {
$filepath = $file->get_filepath();
$filename = $file->get_filename();
$fileurl = file_encode_url($CFG->wwwroot . '/pluginfile.php',
'/' . $ctx->id . '/mod_workshop/submission_attachment/' . $submissionid . $filepath . $filename, true);
$fileurl = moodle_url::make_pluginfile_url($ctx->id, 'mod_workshop', 'submission_attachment',
$submissionid, $filepath, $filename, true);
$embedurl = moodle_url::make_pluginfile_url($ctx->id, 'mod_workshop', 'submission_attachment',
$submissionid, $filepath, $filename, false);
$embedurl = new moodle_url($embedurl, array('preview' => 'bigthumb'));
$type = $file->get_mimetype();
$image = $this->output->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon'));
@ -807,7 +810,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
if ($format == 'html') {
if (file_mimetype_in_typegroup($type, 'web_image')) {
$preview = html_writer::empty_tag('img', array('src' => $fileurl, 'alt' => '', 'class' => 'preview'));
$preview = html_writer::empty_tag('img', array('src' => $embedurl, 'alt' => '', 'class' => 'preview'));
$preview = html_writer::tag('a', $preview, array('href' => $fileurl));
$outputimgs .= $this->output->container($preview);

View File

@ -137,6 +137,13 @@
margin-right: 5px;
}
.path-mod-workshop .submission-full .attachments .images div {
display: inline-block;
margin: 5px;
padding: 5px;
border: 1px solid #ddd;
}
/**
* Example submission - summary display
*/