mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-08 19:44:47 +08:00
@@ -120,8 +120,11 @@ function! emmet#lang#haml#imageSize()
|
|||||||
if fn =~ '^\s*$'
|
if fn =~ '^\s*$'
|
||||||
return
|
return
|
||||||
elseif fn !~ '^\(/\|http\)'
|
elseif fn !~ '^\(/\|http\)'
|
||||||
|
let fn = resolve(expand(fn))
|
||||||
|
if !filereadable(fn)
|
||||||
let fn = simplify(expand('%:h') . '/' . fn)
|
let fn = simplify(expand('%:h') . '/' . fn)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let [width, height] = emmet#util#getImageSize(fn)
|
let [width, height] = emmet#util#getImageSize(fn)
|
||||||
if width == -1 && height == -1
|
if width == -1 && height == -1
|
||||||
|
|||||||
@@ -444,8 +444,11 @@ function! emmet#lang#html#imageSize()
|
|||||||
if fn =~ '^\s*$'
|
if fn =~ '^\s*$'
|
||||||
return
|
return
|
||||||
elseif fn !~ '^\(/\|http\)'
|
elseif fn !~ '^\(/\|http\)'
|
||||||
|
let fn = resolve(expand(fn))
|
||||||
|
if !filereadable(fn)
|
||||||
let fn = simplify(expand('%:h') . '/' . fn)
|
let fn = simplify(expand('%:h') . '/' . fn)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let [width, height] = emmet#util#getImageSize(fn)
|
let [width, height] = emmet#util#getImageSize(fn)
|
||||||
if width == -1 && height == -1
|
if width == -1 && height == -1
|
||||||
|
|||||||
@@ -98,8 +98,11 @@ function! emmet#lang#slim#imageSize()
|
|||||||
if fn =~ '^\s*$'
|
if fn =~ '^\s*$'
|
||||||
return
|
return
|
||||||
elseif fn !~ '^\(/\|http\)'
|
elseif fn !~ '^\(/\|http\)'
|
||||||
|
let fn = resolve(expand(fn))
|
||||||
|
if !filereadable(fn)
|
||||||
let fn = simplify(expand('%:h') . '/' . fn)
|
let fn = simplify(expand('%:h') . '/' . fn)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let [width, height] = emmet#util#getImageSize(fn)
|
let [width, height] = emmet#util#getImageSize(fn)
|
||||||
if width == -1 && height == -1
|
if width == -1 && height == -1
|
||||||
|
|||||||
@@ -241,11 +241,16 @@ function! emmet#util#getImageSize(fn)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! emmet#util#imageSizeWithImageMagick(fn)
|
function! emmet#util#imageSizeWithImageMagick(fn)
|
||||||
|
let fn = a:fn
|
||||||
|
if filereadable(fn)
|
||||||
let img_info = system('identify -format "%wx%h" "'.a:fn.'"')
|
let img_info = system('identify -format "%wx%h" "'.a:fn.'"')
|
||||||
let img_size = split(substitute(img_info, '\n', '', ''), 'x')
|
let img_size = split(substitute(img_info, '\n', '', ''), 'x')
|
||||||
let width = img_size[0]
|
let width = img_size[0]
|
||||||
let height = img_size[1]
|
let height = img_size[1]
|
||||||
return [width, height]
|
return [width, height]
|
||||||
|
else
|
||||||
|
echo 'The file "'.fn.'" does not exist or is not readable'
|
||||||
|
return [-1, -1]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! emmet#util#isImageMagickInstalled()
|
function! emmet#util#isImageMagickInstalled()
|
||||||
|
|||||||
Reference in New Issue
Block a user