經過後續的研究,發現IIP無法在Windows Server 2019上使用,勉強能使用0.9.8以前的版本,但0.9.8只支援Internet Imaging Protocol,不支援IIIF Protocol,只得忍痛放棄。
後來找到了Cantaloupe
使用方式也很簡單,只要安裝JDK,然後修改「cantaloupe.properties.sample」裡面的「FilesystemSource.BasicLookupStrategy.path_prefix」項目,改成影像檔所在的資料夾路徑,然後把「cantaloupe.properties.sample」改名為「cantaloupe.properties」。
之後在cmd輸入下面這行:
java -Dcantaloupe.config=C:\path\to\cantaloupe.properties -Xmx2g -jar cantaloupe-x.x.x.war
「C:\path\to\cantaloupe.properties」就是前一個步驟「cantaloupe.properties」所在的路徑,「cantaloupe-x.x.x.war」是官網下載後解壓縮的war檔,「x.x.x」是版本號,有需要的話也可以加上路徑。
如果下載的不是JDK的話,可能會遇到Could not reserve enough space for object heap error,先下載JDK,然後進bin目錄執行即可。
前台採用的是Leaflet-IIIF,改一下index.js中「id」「info」兩個參數的內容就可以讀圖。
IIIF伺服器架起來後,遇到的問題是跨網域,畢竟原先的web伺服器是走apache的,跟Java的算兩個網域,ajax無法互通,我是採用Curl的方式,用php去Java網站取得資料,網址上面用「.htaccess」的「RewriteRule」騙一下,效果就不錯了。
「.htaccess」的「RewriteRule」教學網站:
「.htaccess」內容:
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
RewriteRule 這裡放輸入的網址 這裡放轉向的網址 [QSA,L]
留言
張貼留言