Forums › Forums › Slimbox2 plugin › "Download this image" doesnt work
- This topic has 21 replies, 6 voices, and was last updated 14 years, 8 months ago by
malcalevak.
-
AuthorPosts
-
at #9351
Nobz
MemberI’m having the same problem, I copied simbox2_autoload.js of Ayrthon but not works for me.
I fixed the problem, here my slimbox2_autoload.js:[code:3do9f1x8]
jQuery(document).ready(function($) {
if(slimbox2_options[’mobile’] || !/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)){
slimbox_CSS();
closeKeys = slimbox2_options[’closeKeys’].split(‘,’);
previousKeys = slimbox2_options[’previousKeys’].split(‘,’);
nextKeys = slimbox2_options[’nextKeys’].split(‘,’);
for ( var i in closeKeys) closeKeys[i] = parseInt(closeKeys[i]);
for ( var i in previousKeys) previousKeys[i] = parseInt(previousKeys[i]);
for ( var i in nextKeys) nextKeys[i] = parseInt(nextKeys[i]);
load_slimbox();
}
});
function slimbox_CSS() {
jQuery(function($) {
$("#lbOverlay").css("background-color",slimbox2_options[’overlayColor’]);
$("#lbPrevLink").hover(
function () {
$(this).css("background-image","url("+slimbox2_options["prev"]+")");
},
function () {
$(this).css("background-image","");
}
);
$("#lbNextLink").hover(
function () {
$(this).css("background-image","url("+slimbox2_options["next"]+")");
},
function () {
$(this).css("background-image","");
}
);
$("#lbCloseLink").css("background-image","url("+slimbox2_options["close"]+")");
})};function load_slimbox() {
jQuery(function($) {
var options = {
loop: slimbox2_options[’loop’],
overlayOpacity: slimbox2_options[’overlayOpacity’],
overlayFadeDuration: parseInt(slimbox2_options[’overlayFadeDuration’]),
resizeDuration: parseInt(slimbox2_options[’resizeDuration’]),
resizeEasing: slimbox2_options[’resizeEasing’],
initialWidth: parseInt(slimbox2_options[’initialWidth’]),
initialHeight: parseInt(slimbox2_options[’initialHeight’]),
imageFadeDuration: parseInt(slimbox2_options[’imageFadeDuration’]),
captionAnimationDuration: parseInt(slimbox2_options[’captionAnimationDuration’]),
counterText: slimbox2_options[’counterText’],
closeKeys: closeKeys,
previousKeys: previousKeys,
nextKeys: nextKeys
}if(slimbox2_options[’autoload’]) {
$("a[href]").filter(function() {
return /.(jpeg|bmp|jpg|png|gif)(?[dw=&]*)?$/i.test(this.href);
}).unbind("click").slimbox(options, function(el) {
return [encodeURI(el.href), (slimbox2_options[’url’])?'<a href="’ + encodeURI(el.href) + ‘">’+eval(slimbox2_options[’caption’])+'</a>’:eval(slimbox2_options[’caption’])];
}, function(el) {
return (this == el) || ($(this).closest(slimbox2_options[’selector’])[0] && ($(this).closest(slimbox2_options[’selector’])[0] == $(el).closest(slimbox2_options[’selector’])[0]));
});
} else {
$("a[rel^=’lightbox’]").unbind("click").slimbox(options, function(el) {
return [encodeURI(el.href), (slimbox2_options[’url’])?'<a href="’ + encodeURI(el.href) + ‘">’+eval(slimbox2_options[’caption’])+'</a>’:eval(slimbox2_options[’caption’])];
}, function(el) {
return (this == el) || ((this.rel.length >
&& (this.rel == el.rel));
});
}/*
HERE THE CODE OF DOWNLOAD IMAGE BUTTON
*/
jQuery(function($) {
$("a[rel^=’lightbox’]").slimbox({/* Put custom options here */}, function(el) {
return [el.href, el.title + ‘<br /><a href="’ + el.href + ‘" target="_self"><img src="http://youdomai.com/images/downloadimg.gif" width="100" height="22" border="0" title="Download Image" /></a>’];
}, function(el) {
return (this == el) || ((this.rel.length >
&& (this.rel == el.rel));
});
});/*
END DOWNLOAD IMAGE CODE BUTTON
*/
if(slimbox2_options[’picasaweb’]) {
$("a[href^=’http://picasaweb.google.’] > img:first-child[src]").parent().unbind("click").slimbox(options, function(el) {
return [el.firstChild.src.replace(//sd+(?:-c)?/([^/]+)$/, "/s640/$2"),
(el.title || el.firstChild.alt) + ‘<br /><a href="’ + encodeURI(el.href) + ‘">Picasa Web Albums page</a>’];
});
}
if(slimbox2_options[’flickr’]) {
$("a[href^=’http://www.flickr.com/photos/’] > img:first-child[src]").parent().unbind("click").slimbox(options, function(el) {
return [el.firstChild.src.replace(/_[mts].(w+)$/, ".$1"),
(el.title || el.firstChild.alt) + ‘<br /><a href="’ + encodeURI(el.href) + ‘">Flickr page</a>’];
});
}
})};[/code:3do9f1x8]
Hope this helps someone.
at #9352Shirly Brazell
MemberWordPress plugin is for?
at #9353malcalevak
ModeratorI’m not sure I understand what you’re asking, Shirly.
at #9354Yen Dearring
MemberThis problem solved?
at #9355malcalevak
ModeratorWhat problem? The original poster wanted to customize the feature, he was able to do so. Not in the best fashion, but in one that works for him.
at #9356krstep
MemberI’ve tried everything in this thread and I just [b:2olh39dt]can’t add[/b:2olh39dt] the download button.
What I want is to add a download button with image that will go through a php file which will download to a computer. I also need the PHP file since I can’t find one that will do that.
So what i need to edit and how to enable to a Download button?
BTW, the code in FAQ doesn’t work too, I tried everything.
Using version 1.1 and WordPress 3.3.1.Thanks in advance.
at #9357malcalevak
ModeratorThis was a custom modification that someone chose to make to the plugin. Aside from what’s been posted here, I don’t know what to tell you. You can try sending a PM to the guy who came up with his own solution and hope he responds.
-
AuthorPosts
- You must be logged in to reply to this topic.