SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
Aug 18, 2007, 07:46 #1
- Join Date
- Feb 2004
- Location
- New York
- Posts
- 474
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Dynamically Generate Calendar Day/Month Image
Hello,
I am trying to figure out out how I can use PHP to dynamically generate the day and month on an image, I know I could break it up into three different images and then do it that way but, I want one solid image.
Here is an example of what I mean: http://www.pen-cei-guest-house.co.uk...gion-wales.htm
On the sidebar to the left you seen under Latest News, there is the day and month, how can i accomplish this with PHP?Ian Gordon
CSS / XHTML / PHP Programmer
http://www.iangordon.us
-
Aug 18, 2007, 08:03 #2
- Join Date
- Dec 2005
- Location
- Cambridge, England
- Posts
- 2,443
- Mentioned
- 82 Post(s)
- Tagged
- 3 Thread(s)
I would think you can do it in either GD or ImageMagick.
Get the current time, format it, put it into a variable then write it to an image.
I would think it is easyer to do in ImageMagick ( shorter anyway ) as in GD you would need to get the length of the text and work out how to center it on the image; ImageMagick all you need to do is center it. Although I suppose once you have written the code its done for everytime.
Check out the code here http://www.rubblewebs.co.uk/imagemag...o=Label_GD.jpg and http://www.rubblewebs.co.uk/imagemag...o=Label_IM.jpg
-
Aug 18, 2007, 10:23 #3
Use one image as a CSS background and do the rest with HTML and CSS. Don't make an image for each; it's a waste of resources.
Location: Alicante (Spain)... Hot and Sunny...
Texas Holdem Poker Probability Calculator | DNS test
Avatars | English Spanish Translation | CAPTCHA with audio
Email | PHP scripts | Cruft free domain names | MD5 Cracker
-
Aug 18, 2007, 15:23 #4
- Join Date
- Feb 2004
- Location
- New York
- Posts
- 474
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I was thinking of that too, I guess I could use javascript or PHP to do it...
Ian Gordon
CSS / XHTML / PHP Programmer
http://www.iangordon.us
-
Aug 18, 2007, 19:55 #5Location: Alicante (Spain)... Hot and Sunny...
Texas Holdem Poker Probability Calculator | DNS test
Avatars | English Spanish Translation | CAPTCHA with audio
Email | PHP scripts | Cruft free domain names | MD5 Cracker
-
Aug 18, 2007, 21:01 #6
- Join Date
- Feb 2004
- Location
- New York
- Posts
- 474
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If the date changes from day to day, how do I retain the value using just HTML and CSS? I would have to use some scripting to determine the day and month.
Ian Gordon
CSS / XHTML / PHP Programmer
http://www.iangordon.us
-
Aug 18, 2007, 21:27 #7
- Join Date
- Jul 2006
- Location
- Ontario, Canada
- Posts
- 424
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Generate the date using PHP, and echo the output into your HTML. You don't need JavaScript for anything, and the generation of the "image" should be done by the CSS.
Bookmarks