PHP生成带有动态日期的PNG

PHP生成带有动态日期的PNG

问题描述:

I'm looking to generate a .png image with a dynamic date, ex:

take today's date +7 days and create a .png that displays that date.

I'd like to keep the .png name the same and just overwrite once a week, always showing the date + 7 from that one day a week.

site.com/img/date.png

Is this possible?

我想生成带有动态日期的.png图像,例如: p> \ n

取今天的日期+7天并创建一个显示该日期的.png。 p>

我想保持.png名称相同,每周只覆盖一次, 始终显示每周一天的日期+7。 p>

  site.com/img/date.png
  code>  pre> 
 
  

这可能吗? p> div>

If you have the GNU date command, you can get the date 7 days from now with:

date -d '+7 days'

You could then pump that, or whatever parts of it you want into the script in my other answer here.

You don't say how you want it formatted, but that script comes up like this:

enter image description here

Imagemagick can do this fairly easily and is easy to have it run as a cronjob for automatic generation.