switch from base64 thumbnail in printer list to relative_path image
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
1 parent
4cdb0b1697
commit
0c10c178aa
1 file changed
+15
-6
@@ -76,9 +76,9 @@ export default {
|
||||
},
|
||||
|
||||
getImage: state => {
|
||||
if (
|
||||
/*if (
|
||||
'gui' in state.data &&
|
||||
'webcam' in state.data.gui.webcam &&
|
||||
'webcam' in state.data.gui &&
|
||||
'url' in state.data.gui.webcam &&
|
||||
state.data.gui.webcam.url !== "" &&
|
||||
'bool' in state.data.gui.webcam &&
|
||||
@@ -88,13 +88,22 @@ export default {
|
||||
state.data.gui.dashboard.boolWebcam
|
||||
) {
|
||||
return state.data.gui.webcam.url
|
||||
} else if (
|
||||
} else*/
|
||||
|
||||
if (
|
||||
state.current_file &&
|
||||
"filename" in state.current_file &&
|
||||
"thumbnails" in state.current_file &&
|
||||
state.current_file.thumbnails.find((element) => element.width === 400 && element.height === 300)
|
||||
state.current_file.thumbnails.length
|
||||
) {
|
||||
return 'data:image/gif;base64,'+state.current_file.thumbnails.find((element) => element.width === 400 && element.height === 300).data
|
||||
} else return "/img/sidebar-background.png"
|
||||
const indexLastDir = state.current_file.filename.lastIndexOf('/')
|
||||
const dir = (indexLastDir !== -1) ? state.current_file.filename.substr(0, indexLastDir) : ""
|
||||
const thumbnail = state.current_file.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
|
||||
|
||||
if (thumbnail && 'relative_path' in thumbnail) return "//"+state.socket.hostname+":"+state.socket.port+'/server/files/gcodes/'+dir+'/'+thumbnail.relative_path
|
||||
}
|
||||
|
||||
return "/img/sidebar-background.png"
|
||||
},
|
||||
|
||||
getLogo: state => {
|
||||
|
||||
Reference in new issue
Block a user