dynamic asset (image) in v2
-
I was able to set dynamic image with ejs in v1. How to make same thing work in v2/ejs with asset
<img align="left" src="{#image <%=image_name%>}" width='40%'/>
-
Images extension is deprecated and not part of the jsreport v2.
Use assets instead.
The dynamic resolution should work there.
-
I am using asset now, I just want to know how can you write #image into #asset form. This is what i am using but its not working. I am setting
image_name=logo
<img align="left" src="{#asset <%=image_name%>.jpeg @encoding=dataURI}" width='40%'/>
I get this error. From the error, I think its not even substituting
image_name
withlogo
.Error: Unable to find or read file C:\source\jsreportapp\<%=image_name%>.jpeg. ENOENT: no such file or directory, open 'C:\source\jsreportapp\<%=image_name%>.jpeg' at module.exports (C:\source\jsreportapp\node_modules\jsreport-core\lib\util\createError.js:9:13) at Reporter.createError (C:\source\jsreportapp\node_modules\jsreport-core\lib\reporter.js:259:12) at readFile (C:\source\jsreportapp\node_modules\jsreport-assets\lib\assets.js:110:20) at <anonymous> caused by: Error: ENOENT: no such file or directory, open 'C:\source\jsreportapp\<%=image_name%>.jpeg'
-
@Farah-Javed you can see example usage of dynamic asset call using ejs here