In this example, we use the setWidth() method to resize an image based on user input. The user specifies a desired width and the height is calculated proportionally. This could be used in a web application where users need to resize images to fit certain space requirements. Package/library: The setWidth() method is part of the GD library, which is a package included with PHP that allows for the creation and manipulation of images.