As part of some other functionality I am generating an image in temp folder and But unforunately I’m not able get the web url of image.
$path = Drupal::service('file_system')->realpath(file_default_scheme() . "://"); $image_path = $path . rand() . '.png'; echo $image_path;
I am getting following as path
C:wampwwwwww_d8test1_comsitesdefaultfiles30605.png
How can I add slash before image name and get actual weburl of image like below?
http://www.d8test1.com/sites/default/files/30605.png