📜 ⬆️ ⬇️

qpimg - dynamic creation of CSS sprites

When developing websites more and more often we have to use CSS sprites technology in order to reduce the number of images uploaded on the page. Creating and editing such images is not a simple task, which takes quite a lot of time: initially you need to arrange the images in a graphic editor, and then describe the positioning and dimensions of each element in the style file (CSS). Editing elements and resizing them may result in a global revision of the sprite, up to its full re-creation.



When using data caching (by the browser) on the client side, sprite debugging also adds “empty” work. It is necessary to change the names of css-files and images each time in order to give the browser new versions of the data.
')
qpimg is a php5 library for creating CSS sprites dynamically (CSS sprites). She solves the above problems.

Example


An example of the script can be found here . This example shows how 18 images are converted to 3 sprites. The first sprite contains static images. The second sprite contains background images that are repeated horizontally. The third sprite contains background images that are repeated vertically.

The result of combining images

Qpimg highlights / benefits



You can learn more about the library, see examples and download the library on the qpimg website .

Source: https://habr.com/ru/post/52539/


All Articles