歡迎光臨, 訪客. 請先 登入註冊一個帳號.
三月 29, 2024, 06:15:47 上午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  外掛程式  |  如何能顯示隨機的照片 « 上篇主題 下篇主題 »
頁: [1]
作者 主題: 如何能顯示隨機的照片  (閱讀 10583 次)
adermons
新手見習
*
文章: 3


檢視個人資料
« 於: 一月 22, 2007, 01:49:50 下午 »

不知有人會用在資料夾傳上圖片,然後在首頁隨機顯示資料夾的圖片。要用那個plugin呢? 嚎啕大哭
已記錄
Todsin
新手見習
*
文章: 13


檢視個人資料
« 回覆文章 #1 於: 一月 26, 2007, 12:50:15 上午 »

目前的plugin因該都不可以,看看mark等兄台有沒有時間做一個了,個人感覺這個應該很多人都需要。
已記錄
hsiaosh
新手見習
*
文章: 37


檢視個人資料 個人網站
« 回覆文章 #2 於: 一月 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
至於這行的意思,不曉得是否表示可以顯示三張?則不得而知,因為我試不出來,總是只顯示一張而已。
已記錄

B2D Server 1028版+Apache:2.0.54+PHP:4.3.10+mysql:4.0.24
安裝在:/var/www/plog
lifetype v1.2.5
採用的是從阿駕那兒學來的自訂網址名稱
Todsin
新手見習
*
文章: 13


檢視個人資料
« 回覆文章 #3 於: 一月 27, 2007, 11:51:34 下午 »

謝謝 hsiaosh 的告知,之前我也用過這個plugin,但是如果你打開plog系統的緩存,這個隨機圖片就不再隨機了。能否想其它blog系統那樣可以自動的循環顯示呢?
已記錄
頁: [1]
LifeType 中文開發論壇  |  開發  |  外掛程式  |  如何能顯示隨機的照片 « 上篇主題 下篇主題 »
    前往: