saveImage

This commit is contained in:
v 2018-11-28 18:36:23 +03:00
parent 6912327ef6
commit 80f23b5650

View File

@ -645,18 +645,14 @@ class Article extends ArticleStub {
return elem.attribs.style = await style.getData()
}
async transformImg ( elem ) {
async saveImage ( elem ) {
delete elem.attribs.srcset
let url = elem.attribs.src
if (! url || url.startsWith( 'data:' ))
return url
return elem.attribs.src = await this.saveImage( url )
}
async saveImage ( url ) {
return
const image = new Image( url )
const localPath = await image.save()
return encodeURI( this.pathToTop() + '../' + localPath )
elem.attribs.src = encodeURI( this.pathToTop() + '../' + localPath )
}
}