Open rustam-mukhametshin opened 5 years ago
In src of image url /yii2images changes into /somedigit, after yii2 latest update.
/yii2images
/somedigit
If patch wont be accepted, and if you dont want to create own package, feel free to use/modify this code.
function fixImages($string) { $replacement = '/yii2images/images/'; $pattern = preg_match('/placeHolder/', $string) ? '/\/images\//' : '/\/(\d+)\/images\//'; return preg_replace($pattern, $replacement, $string); }
I.e. fixImages($model->getImage()->getUrl()) or with getImages
fixImages($model->getImage()->getUrl())
Sorry for my English, and my php experience.
In src of image url
/yii2images
changes into/somedigit
, after yii2 latest update.If patch wont be accepted, and if you dont want to create own package, feel free to use/modify this code.
function fixImages($string) { $replacement = '/yii2images/images/'; $pattern = preg_match('/placeHolder/', $string) ? '/\/images\//' : '/\/(\d+)\/images\//'; return preg_replace($pattern, $replacement, $string); }
I.e.
fixImages($model->getImage()->getUrl())
or with getImagesSorry for my English, and my php experience.