Merge branch 'dev' of http://git.verdnatura.es/salix into dev
This commit is contained in:
commit
8ab9fd270e
|
@ -14,7 +14,7 @@
|
||||||
vn-id="sampleType"
|
vn-id="sampleType"
|
||||||
field="$ctrl.clientSample.typeFk"
|
field="$ctrl.clientSample.typeFk"
|
||||||
model="ClientSample.typeFk"
|
model="ClientSample.typeFk"
|
||||||
select-fields="['id','description','code','hasCompany']"
|
select-fields="['code','hasCompany']"
|
||||||
url="/client/api/Samples"
|
url="/client/api/Samples"
|
||||||
show-field="description"
|
show-field="description"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
|
|
|
@ -20,11 +20,30 @@ router.use('/static/:template/:image', function(request, response) {
|
||||||
return response.json({message: 'Image not found'});
|
return response.json({message: 'Image not found'});
|
||||||
|
|
||||||
let readStream = fs.createReadStream(imagePath);
|
let readStream = fs.createReadStream(imagePath);
|
||||||
|
|
||||||
readStream.on('open', function() {
|
readStream.on('open', function() {
|
||||||
|
let contentType = getContentType(imagePath);
|
||||||
|
|
||||||
|
if (contentType)
|
||||||
|
response.setHeader('Content-type', getContentType(imagePath));
|
||||||
|
|
||||||
readStream.pipe(response);
|
readStream.pipe(response);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getContentType(path) {
|
||||||
|
let types = {
|
||||||
|
png: 'image/png',
|
||||||
|
svg: 'image/svg+xml',
|
||||||
|
gif: 'image/gif',
|
||||||
|
jpeg: 'image/jpeg',
|
||||||
|
jpg: 'image/jpeg'
|
||||||
|
};
|
||||||
|
|
||||||
|
let extension = path.split('.')[1];
|
||||||
|
|
||||||
|
return types[extension];
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -7,10 +7,6 @@ img {
|
||||||
margin: 0
|
margin: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
|
||||||
text-align: justify
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
background-color: #EEE
|
background-color: #EEE
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue