I installed Symfony 4 with Webpack Encore recently. I use some static assets to make a PDF with TCPDF. To do that, I used to get images with their path but with Webpack Encore versionning, filenames are different so I can't get images this way. Is there a solution to keep versionning and access these images in PHP ?
PHP :
$logourl = trim("../public/build/images/tst_noir.png");
$pdf->Image($logourl, 135, 10.8, 42, 0);
Webpack app.js :
require('../images/tst_noir.png');
Webpack-config.js :
const Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('http://localhost/xxx/public/build')
.setManifestKeyPrefix('build/')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.autoProvidejQuery()
.addEntry('app', './assets/js/app.js');
module.exports = Encore.getWebpackConfig();