I have an image called ‘progressbar.png’. Is there a way that I could crop this image, with PHP or Javascript, each time the page loads the image will crop depending on the progress percentage and be loaded into the page. For example, if the image was 200px wide, at 25% progress the image would be cropped to only 50px wide.
Share
Make a div, set the background of the div to your image, and manipulate the div’s width to whatever you want.
HTML:
CSS:
Javascript:
Or it could be done in PHP by simply printing out the width directly to the div: