I would like to add a download button link for the full-sized image on the prettyPhoto lightbox when a user views a photo on my site.
Currently I use the prettyPhoto Media plugin on my site, and I have also used this code (taken from this post) in order to allow prettyPhoto to view a smaller image than the full sized image in galleries so the loading time will be better:
function oikos_get_attachment_link_filter( $content, $post_id, $size, $permalink ) {
// Only do this if we're getting the file URL
if (! $permalink) {
// This returns an array of (url, width, height)
$image = wp_get_attachment_image_src( $post_id, 'large_image_size' );
$new_content = preg_replace('/href=\'(.*?)\'/', 'href=\'' . $image[0] . '\'', $content );
return $new_content;
}
}
add_filter('wp_get_attachment_link', 'oikos_get_attachment_link_filter', 10, 4);
But, since prettyPhoto now is only viewing a thumbnail size of the image, viewers cannot get the full-sized images (around 2000px wide), hence the desire to add a download button, so they can download the full image to use.
Thanks!