PDA

View Full Version : How does this remotely hosted countup work?


hlgask
02-17-04, 09:35 PM
hi,

there is a girl on one of the other boards i surf, who has a countup clock in her signature....i was wondering if its possible to make a countdown or countup clock like this...see link:

http://boards.weddingchannel.com/showthread.php?s=&postid=3111734#post3111734

the signature you are looking for is in the post of user Cyndi915. the countup does refresh - i.e., the numbers do change if you click on other pages and come back to it. the seconds will be different etc. it won't change right in front of your eyes, but it does work.

i have asked her how she did this, but her husband is a programmer and apparently will not help her, help me....

would it be possible to get a remotely hosted countdown/up like this for myself?

TIA for any light you can shed...i know you can't put javascripts, applets or html stuff in sig profiles of the board i use (I'm a forum master at a Proboards.com forum). but what about something remotely hosted?

Heather

Stealth
02-22-04, 10:12 AM
The script will get an image from the server it resides on and sets the content type as a GIF. It then (since its embeded into html) will refresh itself every second and so it counts up. if you physically goto http://pezdspncr.bounceme.net:20003/stuff/marriedfor.asp it wont count up because its not being refreshed.
Ive no idea how this is done but that is the basic function of the script from what i can figure out.

hlgask
02-22-04, 10:16 AM
thanks. i appreciate your looking at it for me. it seems to stump a lot of people i've been asking...some claim they can do it, and then whatever they come up with doesn't work.

Heather

Stealth
02-22-04, 11:00 AM
thanks. i appreciate your looking at it for me. it seems to stump a lot of people i've been asking...some claim they can do it, and then whatever they come up with doesn't work.

Heather

i use the same sort of thing for my avatar on some forums which randomly changes it using asp but nothing like a counter it stumps even me :|

brett
02-22-04, 09:01 PM
Looks like you just need to pass the current seconds into a javascript function which will change the displayed time every second. It should be relatively easy to find how to do this. Look up "javascript clock" and you should find plenty of examples.

pezdspncr
02-24-04, 01:07 PM
It's a simple asp script that uses a com object called aspjpeg to modify an existing jpg (which is just the white background with a black border). The script just takes the difference in the current system time when the script is executed and a set time (when we were married) and displays it in a form people would recognize rather than a bunch of seconds.

Here's the code if you want to give it a try (you need a copy of aspjpeg for it to work though... http://www.aspjpeg.com )


<%

'this is the name of the background pic
picname = "guestcount.jpg"


' Create an instance of AspJpeg object
Set jpeg = Server.CreateObject("Persits.Jpeg")
Path = "c:\inetpub\wwwroot\stuff\" & picname
jpeg.Open(Path)


' Set new height, preserve original width/height ratio
jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth

Jpeg.Canvas.Font.Color = &H000000 'black
Jpeg.Canvas.Font.Size = 14
Jpeg.Canvas.Font.Family = "Garamond"
Jpeg.Canvas.Font.Bold = True

wedtime = "November 1, 2003 15:30:00"
timeleft = datediff("s", now(), wedtime)
timehleft = datediff("h", now(), wedtime)
if timeleft < 1 then
timeleft = -timeleft
timehleft = -timehleft
end if
msg = "The Hunt's! Married for: " & int(timeleft / 86400) & " days, " _
& int(timeleft / 3600) - int(timeleft / 86400)*24 & " hrs, " & int(timeleft / 60) _
- int(timeleft / 3600)*60 & " min, " & timeleft - (int(timeleft / 60) - timehleft*60)*60 _
- timehleft*60*60 & " sec"


Jpeg.Canvas.Print 5, 2, msg

' Send thumbnail data to client browser
jpeg.SendBinary

%>

btw...stumbled across this thread while looking through the good ol server logs :D

pezdspncr
02-24-04, 06:24 PM
or if you want one similar I can make one real quick and host it for you

brett
02-24-04, 07:12 PM
It's a simple asp script that uses a com object called aspjpeg to modify an existing jpg (which is just the white background with a black border). The script just takes the difference in the current system time when the script is executed and a set time (when we were married) and displays it in a form people would recognize rather than a bunch of seconds.)


If you are wanting it to dynamically increase in the same page you are going to have to use some CSS and Javascript rather than a dynamically generated image. If you don't want the counter increasing then the image is definately a better method and more simple method that is easier to introduce into the pages.

hlgask
02-24-04, 07:39 PM
hi,

thanks for the help. i am very interested in learning how to do this myself, so that i can help other people do it. i didn't get the subscription notices that someone had replied to this thread after the 1st reply, so hadn't been watching this thread...i appreciate now what server logs can do!

i am considering whether or not this would be too complicated for me to learn to do, and to host myself. i am a message board admin at a proboards forum, and would like to help my members get countdowns etc.

if its a matter of my cutting and pasting a code (and seeing how to alter it from user to user), and hosting it myself, then i think it would be possible. i don't want to bother anyone beyond that. if its a lot more complicated than that, then i don't want to take up a lot of time worrying about it. :)

interesting that you found this message!

Heather

hlgask
02-24-04, 07:42 PM
can this sort of thing be hosted at an online photo storage facility? one that permits animated .gifs (not just .jpeg's, which is what a lot of them will only permit).

Heather

hlgask
02-24-04, 07:58 PM
p.s. i would be perfectly satisfied with a countdown/up that doesn't refresh as you're looking at the same page. (one that doesn't dynamically refresh on the same page as someone else mentioned.) one that had refreshed when you came back to it would be fine.

Heather

pezdspncr
02-24-04, 08:02 PM
well..the reason it isn't javascript is because most forums don't allow javascript in their sigs. I chose asp cause I was a little familiar with that already. I think the dynamic pic can also be done easily in php but I don't know much about php. The reason why I use aspjpeg is to have a background to the text. If you don't need a background and just want the countdown/up text you don't need aspjpeg.

I don't think it can be hosted on any online photo storage places because it's actually a serverside script that needs to be executed by the webserver on the host computer. Usually why most people who have dynamic sigs on message boards host it themselves.

So...basically...it's easy if you run your own webserver...if not you'd have to find a host that processes asp pages or php if you can figure out how to do it in php.

Hope that helps :)

edit: I couldn't figure out a way for it to change as you're watching it other than it being javascript or flash. And since most boards don't allow either one in your sig it would have been sorta useless to try and figure out how to do it that way.

hlgask
02-24-04, 08:04 PM
thank you again. i just went to aspjpeg.com and noticed the license for it costs $150. (i think i need that, right?) i think i will have to decline using it for now! but it was definitely interesting to talk to you about it, thank you very much for your time.

Heather

p.s. if it bothers you or your wife that i put a message out on the internet that mentions her username and directs people to her sig, then i will delete this message. hope she's not mad at me...

pezdspncr
02-24-04, 09:25 PM
you don't HAVE to use aspjpeg. If all you want is to display text you don't need aspjpeg.

example: http://pezdspncr.bounceme.net:20003/sigs/testing.jpg


<%


wedtime = "November 1, 2003 15:30:00"
timeleft = datediff("s", now(), wedtime)
timehleft = datediff("h", now(), wedtime)
if timeleft < 1 then
timeleft = -timeleft
timehleft = -timehleft
end if
msg = "The Hunt's! Married for " & int(timeleft / 86400) & " days, " _
& int(timeleft / 3600) - int(timeleft / 86400)*24 & " hrs, " & int(timeleft / 60) _
- int(timeleft / 3600)*60 & " min, " & timeleft - (int(timeleft / 60) - timehleft*60)*60 _
- timehleft*60*60 & " sec"


response.write msg



%>

also I think php can display the text on a background image without any third party object..but I can't help with php :D

busyweb
03-14-04, 12:40 AM
Hello,
here is the sample running..
It's done from .Net Imaging class (like java calss)..

All the text is dynamically generated, and can be updated
with any values instantly.

sample url:
http://www.busyphoto.com/albumview.aspx?aid=9

thanks