简体   繁体   English

MODx Gallery 无法正确显示图像

[英]MODx Gallery not displaying images correctly

I have recently set up a website using MODx Revolution.我最近使用 MODx Revolution 建立了一个网站。 I am attempting to make a gallery, using the plugin of the same name.我正在尝试使用同名插件制作画廊。 I would like it so that you can click a link, which displays the original image, as it was uploaded.我想要它,以便您可以单击一个链接,该链接显示原始图像,因为它是上传的。 Here is the code for my gallery page:这是我的画廊页面的代码:

<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>

The code that is causing the problems is:导致问题的代码是:

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

which generates the following (example) url:生成以下(示例)url:

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

If you follow it (go ahead, try it,) on Internet Explorer (tested on 6 and 9).如果您在 Internet Explorer(在 6 和 9 上测试)上遵循它(继续,尝试它)。 it shows the image just fine, On every other browser i've tested, however.它可以很好地显示图像,但是在我测试过的所有其他浏览器上。 it gives the same as you would get from loading the image in notepad++ or another text editor.它提供的效果与您在 notepad++ 或其他文本编辑器中加载图像所获得的效果相同。

doing "Right-click Save As" on the image causes the php redirect to be saved, rather than the image, and "Right-click view image" gives the same as the link above.在图像上执行“右键单击另存为”会导致 php 重定向被保存,而不是图像,并且“右键单击查看图像”与上面的链接相同。

Therefore, I am asking either a) is there a way to fix this, or b) is there a way to link to the image directly, instead of going via the php page?因此,我要问 a) 有没有办法解决这个问题,或者 b) 有没有办法直接链接到图像,而不是通过 php 页面?

Thanks for any help you can give,谢谢你提供的所有帮助,

Simon西蒙

Try [[+image_absolute]] in your template chunk.在您的模板块中尝试 [[+image_absolute]]。

Sort of stumped why one would post this on StackOverflow instead of on the MODX forums though - there's more people monitoring that (I only got here via Twitter).有点难过为什么有人会在 StackOverflow 上而不是在 MODX 论坛上发布这个 - 有更多的人在监视它(我只是通过 Twitter 到这里的)。

It seems like your MIME-type configuration is incorrect.您的 MIME 类型配置似乎不正确。 The PHP-script connector.php should tell browser that the currently served URL is an image. PHP-script connector.php 应该告诉浏览器当前提供的 URL 是一个图像。

However, if you use Firebug (or Chrome Dev / Safari Dev etc) and check your response type, it will give you:但是,如果您使用 Firebug(或 Chrome Dev / Safari Dev 等)并检查您的响应类型,它将为您提供:

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!

Content-type "text/html" is not what you want to serve, but that is what the server/php-script gives.内容类型“text/html”不是您想要提供的,但那是 server/php-script 提供的。

Check your Apache (if that's what you fancy) configuration OR, if you're using a web hosting, your .htaccess-file.检查您的 Apache(如果您喜欢的话)配置,或者,如果您使用的是 web 托管,请检查您的 .htaccess 文件。

AddType image/jpg .jpg

Similar configuration exists for other webservers (nginx, lighttpd, cherokee...) as well.其他网络服务器(nginx、lighttpd、cherokee...)也存在类似的配置。 If it didn't work you can tweak the connector-script (haven't checked its source) to force a MIME-type.如果它不起作用,您可以调整连接器脚本(尚未检查其来源)以强制使用 MIME 类型。 Discussed in Show image in php script在 php 脚本中显示图像中讨论

(I realize that is was over a month since you posted this question, but since it wasn't marked as solved I hope this will help you or someone else) (我意识到自您发布此问题以来已经过去了一个多月,但由于它没有被标记为已解决,我希望这会对您或其他人有所帮助)

This was an issue with Gallery 1.2.0, which has been solved in 1.2.1.这是 Gallery 1.2.0 的问题,已在 1.2.1 中解决。

Thanks for all your suggestions!感谢您的所有建议!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM