I am using Jquery PrettyPhoto to have a slide show, however it does not let the users to download the images. Anyone know how can I add a link to it so users will be able to download the images?
Here is my code: (I am using prettyPhoto Widget in Yii, but any answer in general for prettyPhoto will be great)
<?php
$this->beginWidget('ext.prettyPhoto.PrettyPhoto', array(
'id'=>'pretty_photo',
// prettyPhoto options
'options'=>array(
'opacity'=>0.60,
'modal'=>true,
),
));
?>
<div class="column4-front image-gallery">
<a href="/files/show/<?php echo $data->image; ?>" rel="prettyPhoto[pp_gal]" title="<?php echo $data->caption; ?>">
<img src="/files/show/thumb/<?php echo $data->image; ?>" />
</a>
</div>
<?php $this->endWidget('widgets.prettyPhoto');?>
Easy!
HTML (title is empty!)
<a id="photo_link" href="http://link_to_image_or_video" rel="prettyPhoto" title="">
<img src="images/play-video.png" alt="" title="" width="380" height="147" />
</a>
JS (inside the document ready)
//do not show title on download link hover (download button)
$("#photo_link").hover(function(e){
$(this).attr('data-title', $(this).attr('title'));
$(this).removeAttr('title');
},
function(e){
$(this).attr('title', $(this).attr('data-title'));
});
//add download link on the fly on click of photo link
$("#photo_link").on('click', function(){
$(this).attr('title', '<div class="center"><a href="#download_link" class="btn btn-primary btn-lg"><strong>Download</strong></a></div>');
});
No PrettyPhoto JS changes are necessary. Here is the simple idea. Yours to play inside Yii framework.
Even easier: Only JS (include JS in your view)
$("a[rel^='prettyPhoto']").prettyPhoto({
social_tools: '<div class="center"><a id="get_started" href="#contact" class="btn btn-primary btn-lg"><strong>Download</strong></a></div>',
default_width: 800,
default_height: 450
});