Skip to content

Commit a706419

Browse files
committed
feat: display uploaded images
1 parent adfae66 commit a706419

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

examples/Calinski-Harabasz/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The following are the results of running the code on MATLAB R2015b - your result
4343
| linkage | 1 | \_NaN\_ |
4444
| kmeans | 1 | \_NaN\_ |
4545

46-
Each experiment also produces two scatter plots to show the clustering - one based on sepal length vs. sepal width, and the other based on petal length vs. petal width.
46+
Each experiment also produces two scatter plots to show the clustering - one based on sepal length vs. sepal width, and the other based on petal length vs. petal width. Note that FGLab automatically displays uploaded images, so it is possible to create the plots within MATLAB and have them displayed on the experiment page.
4747

4848
## Citations
4949

examples/Recurrent-Attention-Model/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ For each glimpse, the extracted patches, `patch<x>.png`, are also extracted:
3838

3939
![patch1](https://raw.githubusercontent.com/Kaixhin/FGLab/master/examples/Recurrent-Attention-Model/patch1.png)
4040

41+
These images are displayed along with the normal download link for uploaded files.
42+
4143
## Citations
4244

4345
[1] Mnih, V., Heess, N., & Graves, A. (2014). Recurrent models of visual attention. In *Advances in Neural Information Processing Systems* (pp. 2204-2212).

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ app.put("/api/experiments/:id/files", upload.array("_files"), function(req, res,
350350
gfs.write(fileObj.buffer, true)
351351
.then(function(gfs) {
352352
// Save file reference
353-
filesP[i] = db.experiments.updateByIdAsync(req.params.id, {$push: {_files: {_id: gfs.fileId, filename: gfs.filename}}});
353+
filesP[i] = db.experiments.updateByIdAsync(req.params.id, {$push: {_files: {_id: gfs.fileId, filename: gfs.filename, mimetype: gfs.contentType}}});
354354
})
355355
.catch(function(err) {
356356
console.log(err);

views/experiment.jade

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ block scripts
9595
// Add files
9696
var $files = $("#files");
9797
for (var i = 0; i < experiment._files.length; i++) {
98-
$files.append("<li><a href='/files/'" + experiment._files[i]._id + "'>" + experiment._files[i].filename + "</a></li>");
98+
var file = experiment._files[i];
99+
if (file.mimetype.indexOf("image/") === 0) {
100+
$files.append("<li><img src='/files/" + file._id + "' class='img-responsive'></li>");
101+
}
102+
$files.append("<li><a href='/files/" + file._id + "'>" + file.filename + "</a></li>");
99103
}
100104

101105
if (experiment._charts) {

0 commit comments

Comments
 (0)