I am trying to get prettyphoto to work within my rails app. I would like to have an image display in prettyphoto that is uploaded by the paperclip gem.
I am running rails 3.2.8, paperclip 3.1.4, and the hiq5/prettyphoto-rails gem.
Here is what I have at the end of the body:
<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>
Here is the rails link_to:
<%= link_to image_tag(@client.price_plan.flier1.url(:small)), @client.price_plan.flier1.url(:medium), rel: "prettyPhoto" %>
I think the problem is the link possibly that paperclip creates with the string on the end?
Example:
http://localhost:3000/price_plans/flier1s/3/small_1180001_SF6w.jpg?1345698254
Does prettyphoto need the ?1345698254 stripped off the link to work?
Example:
http://localhost:3000/price_plans/flier1s/3/small_1180001_SF6w.jpg
If so, how can I do that in paperclip?
Thanks,
I finally got back to this issue and was able to resolve it with the current version. It might be a bug but I discovered that by setting rel: 'prettyPhoto' did not work and rel: "prettyPhoto" did work???
final link looked like this:
<%= link_to "PrettyPhoto test", @client.price_plan.flier1.url(:medium), rel: "prettyPhoto", class: "prettyphoto" %>
Hope that helps others....