我正在尝试让漂亮的照片在我的rails应用程序中工作。我想有一个由回形针宝石上传的漂亮照片中的图像显示。
我运行的是rails 3.2.8,回形针3.1.4和hiq5/prettyphoto rails gem。
这是我在正文末尾的内容:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto({
animationSpeed: 'normal', /* fast/slow/normal */
padding: 40, /* padding for each side of the picture */
opacity: 0.35, /* Value betwee 0 and 1 */
showTitle: false, /* true/false */
allowresize: true, /* true/false */
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
theme: 'light_rounded' /* light_rounded / dark_rounded / light_square / dark_square */
});
});
</script>下面是rails的link_to:
<%= link_to image_tag(@client.price_plan.flier1.url(:small)), @client.price_plan.flier1.url(:medium), rel: "prettyPhoto" %>我认为问题可能是回形针与尾部的字符串创建的链接?
示例:
http://localhost:3000/price_plans/flier1s/3/small_1180001_SF6w.jpg?1345698254漂亮的照片需要去掉1345698254的链接才能工作吗?
示例:
http://localhost:3000/price_plans/flier1s/3/small_1180001_SF6w.jpg如果是这样,我怎样才能在回形针中做到这一点呢?
谢谢,
发布于 2013-01-27 12:55:59
我最终回到了这个问题上,并能够用当前版本解决它。这可能是一个bug,但我发现通过设置rel:'prettyPhoto‘不起作用,rel:"prettyPhoto“起作用?
最终的链接看起来像这样:
<%= link_to "PrettyPhoto test", @client.price_plan.flier1.url(:medium), rel: "prettyPhoto", class: "prettyphoto" %>希望这能帮助其他人……
https://stackoverflow.com/questions/12127406
复制相似问题