"Download this image" doesnt work

Forums Slimbox2 plugin "Download this image" doesnt work

This topic contains 21 replies, has 6 voices, and was last updated by  malcalevak 1 year, 5 months ago.

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #9351

    Nobz
    Member

    I’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.

    #9352

    WordPress plugin is for? 

    #9353

    malcalevak
    Member

    I’m not sure I understand what you’re asking, Shirly.

    #9354

    Yen Dearring
    Member

    This problem solved? 

    #9355

    malcalevak
    Member

    What 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.

    #9356

    krstep
    Member

    I’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.

    #9357

    malcalevak
    Member

    This 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.

Viewing 7 posts - 16 through 22 (of 22 total)

You must be logged in to reply to this topic.