LifeType 中文開發論壇

開發 => 外掛程式 => 主題作者是: adermons 於 一月 22, 2007, 01:49:50 下午



主題: 如何能顯示隨機的照片
作者: adermons一月 22, 2007, 01:49:50 下午
不知有人會用在資料夾傳上圖片,然後在首頁隨機顯示資料夾的圖片。要用那個plugin呢? :'(


主題: Re: 如何能顯示隨機的照片
作者: Todsin一月 26, 2007, 12:50:15 上午
目前的plugin因該都不可以,看看mark等兄台有沒有時間做一個了,個人感覺這個應該很多人都需要。


主題: Re: 如何能顯示隨機的照片
作者: hsiaosh一月 26, 2007, 08:26:52 上午
其實是有的,就是那個 galleryimages 的 plugins,它就可以使用檔案中心資料夾裡的圖片,來做放在首頁上的隨機照片。

底下是它的說明:

**************************************************************************
This plugin offers two methods, one for fetching the most recently uploaded image and another one for retrieving a random image from our collection. Needless to say, this plugin only returns images and not any other type of resource. Only images that belong to public albums will be used.

You can use the following snippet of template code to show the latest uploaded image in your templates:

{assign var=latestImage value=$galleryimages->latestImage()}
<a href="{$url->resourceLink($latestImage)}">
<img style="border:0px;" src="{$url->resourcePreviewLink($latestImage)}" alt="{$latestImage->getDescription()}" />
</a>

To show a random image from your collection, you can use the following snippet:

{assign var=randomImage value=$galleryimages->randomImage(9)}
<a href="{$url->resourceLink($randomImage)}">
<img style="border:0px;" src="{$url->resourcePreviewLink($randomImage)}" alt="{$randomImage->getDescription()}" />
</a>

And, you can use

{$galleryimages->randomImage(8)} to get 1 random image from album id=8, or use
{$galleryimages->randomImage(10,3)} to get the 3 random images from album id=10

Or, you also can use

{$galleryimages->lastImage(8)} to get last 1 upload image from album id=8, or use
{$galleryimages->lastImage(10,3)} to get last 3 upload images from album id=10
**************************************************************************

目前我個人是使用 randomImage 的方式,但只能顯示一張,
>{$galleryimages->randomImage(10,3)} to get the 3 random images from album id=10
至於這行的意思,不曉得是否表示可以顯示三張?則不得而知,因為我試不出來,總是只顯示一張而已。


主題: Re: 如何能顯示隨機的照片
作者: Todsin一月 27, 2007, 11:51:34 下午
謝謝 hsiaosh 的告知,之前我也用過這個plugin,但是如果你打開plog系統的緩存,這個隨機圖片就不再隨機了。能否想其它blog系統那樣可以自動的循環顯示呢?