0

我正在尝试让 prettyphoto 在我的 rails 应用程序中工作。我想在回形针宝石上传的漂亮照片中显示图像。

我正在运行 rails 3.2.8、paperclip 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

Prettyphoto 是否需要从链接中剥离 ?1345698254 才能工作?

例子:

http://localhost:3000/price_plans/flier1s/3/small_1180001_SF6w.jpg

如果是这样,我怎么能在回形针中做到这一点?

谢谢,

4

1 回答 1

1

我终于回到了这个问题,并能够用当前版本解决它。这可能是一个错误,但我发现通过设置 rel: 'prettyPhoto' 不起作用,而 rel: "prettyPhoto" 确实起作用了???

最终链接如下所示:

<%= link_to "PrettyPhoto test", @client.price_plan.flier1.url(:medium), rel: "prettyPhoto", class: "prettyphoto" %>

希望对其他人有所帮助....

于 2013-01-27T04:55:58.583 回答