开发者

how to synchronize a content of animated gif with link which should lead to proper site according to displayed frame

开发者 https://www.devze.com 2023-04-06 23:39 出处:网络
I am preparing some banners in GIFs. GIF will contain for instance 3 images, which will be displayed 10s each of them in neverending loop.

I am preparing some banners in GIFs.

GIF will contain for instance 3 images, which will be displayed 10s each of them in neverending loop.

example:

  • images with logo stackoverflow.com - 20s
  • images with logo superuser.com - 20s
  • images with logo webmasters.stackexchange.com - 20s

together in one gif.

I am preparing this keeping in mind, that user can use it for instance on phpBB forums:

[url=link_to_site][img]someaddress/imageWithThreeFrames.gif[/img][/url]

The whole thing is that link_to_site should lead to proper site... if superuser.com frame is displayed, then link in somehow should lead to http://superuser.com, etc.

I know that this is almost impossible in traditional way.. so please let me explain how I see it...

gif is not traditional gif, but PHP script, which will be return normal gif and also save information on what time specific gif was requested. Is it possible to save a kind of finger开发者_运维百科print of user, which requested this PHP? Or this will be rather a fingerprint of forum?

link_to_site could be a indirect link of another PHP script on my server, which will calculate which frame was displayed if link was clicked X second after generating gif.

Does it have any chance of working?


If you're using BBcode to display the .gif as you mentioned above, then unfortunately, there is no way of doing what you're asking.

If you really wanted to make that work, you would have to use some sort of javascript code, which I don't think you can on a forum, at least not without special privileges or a mod of some sort.

As for saving the fingerprint of the user, you won't be able to retrieve any date from the forum itself, but you should be able to get the users IP address with "$_SERVER['REMOTE_ADDR']" in your PHP script.


I think I've found a solution!

link_to_site will lead to PHP script, which will redirect to proper site according to TIME on server!

  • hh:mm:01 - hh:mm:10 -> site 1
  • hh:mm:21 - hh:mm:40 -> site 2
  • hh:mm:41 - hh:mm:30 -> site 3

if gif will be requested in hh:mm:24, knowing average time of creating gif(in this case assume 1s) I can set duration of each frame like this:

  • 15s - (hh:mm:25-hh:mm:40] second image
  • 20s - (hh:mm:41-hh:mm:00] third image
  • 20s - (hh:mm:01-hh:mm:20] first image
  • 5s - (hh:mm:21-hh:mm:24] second image

and loop...

so more or less on 10:22:48 (server time) everywhere should be visible this same, third frame :)

What do you think about that? :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号