Answer the question
In order to leave comments, you need to log in
How to create an image in a script?
I want to make favicon dynamic. Whatever every day, there was a different picture - the figure of the current day of a certain color on a certain color background. Presumably you need to do it in the form of a script. Apache (or nginx) forwards the mysite/favion.ico request to the correct script, which determines the number and draws it.
Now the question is how to do it? I want to write a script in python, but I don't know which side to approach. Of course, you can prepare 31 pictures in advance and give them in the script, but this is not sporty :-)
Answer the question
In order to leave comments, you need to log in
Python Imaging Library ( PIL ) + nginx (set location /favicon.ico to cache the backend response ~30-60 minutes, and the corresponding max-age). Indeed, this is dubious.
There was an article on Habré on how to do this in JS - on the client, the picture was drawn and set
Give the response type image/png or something else and return the content of your icon.
In order to generate the content of your icon, I think PIL is suitable , but I have not worked with it myself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question