开发者 | kvu022 |
---|---|
更新时间 | 2015年2月4日 19:33 |
PHP版本: | 2.6 及以上 |
WordPress版本: | 4.1 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
<div>
containing your image. It will refresh every 60 seconds.
You can specify a different refresh time
[image-autorefresh src="image-url" refresh_time=10]
Add a caption
[image-autorefresh src="image-url" caption="Your caption"]
Or specify a different alignment (left
, right
, center
or none
)
[image-autorefresh src="image-url" align="center"]
Add width and height in pixels
[image-autorefresh src="image-url" width=320 height=240]
Add classes to the image
[image-autorefresh src="image-url" class="your_custom_class"]
Add a custom query string to the image
[image-autorefresh src="image-url" query_string="usr=test_user&password=some_password"]
Examples
The shortcode
[image-autorefresh
src="http://weather.cs.uit.no/wcam0_snapshots/wcam0_latest_small.jpg"
refresh_time=120
caption="A view from Tromsø university"
align="center"]
will generate the following code inside your post:
setInterval(function()
{
d = new Date();
image = jQuery('img#image_autorefresh_timb8XZCWL');
image.attr("src", image.data("src") + "?" + d.getTime());
}, 120000);
A view from Tromsø university
Which will automatically refresh the live view from Tromsø every 120 seconds
Multiple images
The shortcode allows for multiple images on one page with different refresh rates.
Yes, you can sue the shortcode multiple times and set different refresh intervals for each.
query_string
to add any query parameters necessary to load the image