2011-06-05 45 views
0

我最近使用MODx Revolution設置了一個網站。我正在嘗試使用相同名稱的插件製作一個畫廊。我希望它能夠點擊一個鏈接,該鏈接顯示原始圖片,因爲它已上傳。這裏是我的畫廊頁面代碼:MODx圖庫無法正確顯示圖像

<div class="ContentHead">[[*longtitle]]</div> 
<p>This page contains galleries of various images I have taken or made. Each has a description, so feel free to browse. Clicking thumbnails will reload the page, and may take some time to load a larger version of the image - but it will get there!</p> 

<p>[[!Gallery? &toPlaceholder=`gallery`]] [[!GalleryItem? &imageWidth=`900` &imageHeight=`900`]] [[!GalleryAlbums? &prominentOnly=`0` &limit=`0` &rowTpl=`galAlbumRowTplCustom` &toPlaceholder=`galleries`]]</p> 

<div align="center">| [[+galleries]]</div> 
<hr /> 
<p><a name="largeImage"></a></p> 
<p> </p> 

<p>[[!+galitem.image:notempty=`</p><div class="image"><img class="[[+galitem.imgCls]]" src="[[+galitem.image]]" alt="[[+galitem.name]]" /><br/>[[+galitem.description]]<br />Albums: [[+galitem.albums]] <br />Tags: [[+galitem.tags]]<br/><a href="[[!+galitem.image]]">View original image</a><hr /></div> <p>`]] 

[[!+gallery:notempty=`</p><div ><h1 style="font-size: 20px; font-weight: bold; font-family: Calibri;">[[+gallery.name]]</h1><h2 style="font-size: 18px; font-weight: normal; font-family: Calibri;">[[+gallery.description]]</h2><p> </p><h2 style="font-size: 18px; font-weight: normal; font-family: Calibri;">[[+gallery]]</h2> </div>`]] 

<div style="height:600px"><!--This ensures that when a thumb is clicked, the gallery isn't pushed below the footer.--></div> 

導致該問題的代碼:

<a href="[[!+galitem.image]]">View original image</a> 

產生以下(例子)網址:

http://www.reflectric.com/assets/components/gallery/connector.php?action=web/phpthumb&w=900&h=900&zc=0&far=&q=90&src=http%3A%2F%2Fwww.reflectric.com%2Fassets%2Fcomponents%2Fgallery%2Ffiles%2F3%2F28.bmp 

如果您按照它(繼續,嘗試它!)在Internet Explorer上(在6和9測試),它顯示圖像就好了。然而,在我測試過的每一個瀏覽器中,它都會提供與在記事本++或另一個文本編輯器中加載圖像相同的結果。

在圖像上執行「右鍵另存爲」會導致保存php重定向,而不是圖像,而「右鍵單擊視圖圖像」與上面的鏈接相同。

因此,我要求要麼 a)是有辦法解決這個問題, 或b)是有辦法直接鏈接,而不是通過PHP頁面將圖像,?

感謝您的幫助,您可以給,

西蒙

回答

0

看起來您的MIME類型配置不正確。 PHP腳本connector.php應該告訴瀏覽器當前提供的URL是一個圖像。

然而,如果你使用Firebug(或Chrome開發/ Safari開發等),並檢查您的響應方式,它會給你:

HTTP/1.1 200 OK 
Date: Mon, 18 Jul 2011 09:11:37 GMT 
Server: Apache 
X-Powered-By: PHP/5.2.17 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache 
Vary: Accept-Encoding 
Content-Encoding: gzip 
Keep-Alive: timeout=10, max=29 
Connection: Keep-Alive 
Transfer-Encoding: chunked 
Content-Type: text/html  <===================== INCORRECT! 

內容類型「text/html的」是不是你想要的服務,但這是服務器/ php腳本給。

檢查你的Apache(如果這就是你喜歡的)配置,或者如果你使用虛擬主機,你的.htaccess文件。

AddType image/jpg .jpg 

其他網絡服務器(nginx,lighttpd,cherokee ...)也有類似的配置。如果不起作用,您可以調整連接器腳本(未檢查其源)以強制使用MIME類型。在Show image in php script

討論(我知道是有人在一個月,因爲你張貼了這個問題,但由於它沒有標記爲解決我希望這會幫助你或其他人)

+0

關於splittingreds Gallery github-repo報告了類似的問題。然而,圖像然後沒有使用 ...服務。問題在幾天後關閉。見:https://github.com/splittingred/Gallery/issues/104 – Wolff 2011-07-18 09:42:02

+0

這個評論是正確的答案 - 基本上這是一個問題,與圖書館的版本,它已經在下一次更新中解決 – simonalexander2005 2011-07-19 15:47:07

0

嘗試[[+ image_absolute]模板中的塊。不知道爲什麼一個人會在StackOverflow而不是在MODX論壇上發佈這個 - 雖然有更多的人監測(我只通過Twitter獲得)。

+0

堆棧溢出確實有一些MODx的問題 - 我以前在MODx論壇上沒有得到答案,但我總是得到一個在這裏...加上我得到這裏的聲譽:-P – simonalexander2005 2011-06-06 16:31:56

+0

[[+ image_absolute]]不起作用,甚至無法解析到有效的鏈接(它只是進入我的主頁)。爲了澄清,我還沒有安裝phpthumb - 只是隨着畫廊來。 – simonalexander2005 2011-06-06 16:34:00

+0

MODx論壇不是非常活躍。 – mmcglynn 2012-04-18 17:17:41

0

這是有問題Gallery 1.2.0,已在1.2.1中解決。

感謝您的所有建議!

+0

wolff回答它和你讓自己獲勝:) – Yasir 2011-09-22 09:09:17