2011-06-05 44 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