开发者

How to integrate Yoxview to Rails 3 application when pictures are protected by Controller?

I'm trying to integrate Yoxview to my Rails 3 application that uses Paperclip to upload pictures.

The main problem is that the pictures (both original and thumbs) are not in the public area, i.e. they are accessible via Controller as described here.

The relevant HTML looks like:

<div id="my_wrapper">
  <a href="/assets/1/original"><img src="/assets/1/thumb" /></a>
  <a href="/assets/2/original"><img src="/assets/2/thumb" /></a>
</div>

When a thumbnail is clicked, I expect the Yoxview player to be opened, but what happens is that the original picture is opened in a browser.

When the pictures are in the public area like this:

<div id="my_wrapper">
  <a href="/images/originals/1.jpg"><img src="/images/thumbs/1.jpg" /></a>
  <a href="/images/originals/2.jpg"><img src="/images/thumbs/2.jpg" /></a>
</div>

everything works perfectly!

Any ideas ?


UPDATE

I tried also:

<div id="my_wrapper">
  <a href="/images/originals/1.jpg"><img src="/images/thumbs/1.jpg" /></a>
  <a href="/images/originals/2.jpg"><img src="/images/thumbs/2.jpg" /></a>
  <a href="/assets/1/original"><img src="/assets/1/thumb" /></a>
  <a href="/assets/2/original"><img src="/assets/2/thumb" /></a开发者_C百科>
</div>

Here, if I click on thumbs/1.jpg or thumbs/2.jpg the player is opened properly, but shows only these two (original) pictures. If I click on one of the other two thumbs, their original picture is opened in a browser.


I found the answer. It's so simple. Just had to use the allowedUrls option of Yoxview:

allowedUrls: /^\/assets\/\d+\/(thumb|original)$/i
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜