First of all, it's easy to deduce from the nature of my question that I am complete beginner as far as Ruby is concerned. I was wondering is Ruby capable of creating a website that is able to rotate images say, once per hour; - have a timer that counts from 60 to 0 mins that is linked to that image rotation; - all while being able to get images for said rotation (in certain order) from a folder I earlier specified. I am sorry if I didn't formulate my question correctly, but this is as near as I can get to verbally expressing my problem on a forum, considering I am not native English speaker. Thanks in advance
on 2013-02-01 04:20
on 2013-02-01 04:27
Yes it can but it would be better to use jquery for that purpose. Google "jquery image slider" and you will see many examples
on 2013-02-01 07:16
Hello Goran ~ You can use ruby for your purpose. Though what you want to look into is called a service or daemon. There are external gem projects if you just need the functionality or you could look into how to create it by hand. Another technique would be to build your rotation function to trigger based on get request. Either way you will need to create a state for comparing previous time to the new time before rendering the page. ~
on 2013-02-02 05:22
On Thu, Jan 31, 2013 at 9:20 PM, Goran S. <lists@ruby-forum.com> wrote: > I was wondering is Ruby capable of creating a website that is able to > rotate images say, once per hour; > - have a timer that counts from 60 to 0 mins that is linked to that > image rotation; > - all while being able to get images for said rotation (in certain > order) from a folder I earlier specified. I'm not exactly sure what you want here -- are you talking about a page that stays on user's browser for hours at a time? Or do you mean to change the image downloaded by many users over the course of a day once per hour? Both are quite doable in Ruby, although the implementation would be somewhat different. In the first case, where you want the web page to be sitting around being viewed for hours, you could do it with a page refresh to reload the entire page and the new image, or you could do it with an AJAX call to just load the image. Or, depending on how many images (and how big they are) you're talking about, you wouldn't even need an AJAX call, you could download all the images and just use a JavaScript timer to swap the images. (This is typically referred to as a carousel; google "JavaScript carousel".) In the second case, you wouldn't actually need a timer, per se, just store a Time when the current image expires. Then, when the site is loaded, check to see if the time has passed and substitute the next image and set a new expiration time.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.