If you have Html file with image tags and you want to achieve is to replace the image src with PHP with new source i.e. you want a new image by just passing source like (pass your image source and get new image,
<?php $new_src="images/Sunset.jpg" ?>
like in above code and you will get new image). Just by including these below lines of code you will get new image.
How to change source or path of image tag in php
How to change image src path with php?
How to set Path for “img src” tag in php?
Change sources of image by php function or code
Just pass source and get new image with php
GET new image by passing sources only