Forums › Forums › Slimbox2 plugin › "Download this image" doesnt work
- This topic has 21 replies, 6 voices, and was last updated 12 years, 9 months ago by malcalevak.
-
AuthorPosts
-
July 10, 2011 at 1:40 pm #1777AnonymousMember
Hi,
I found this code in the FAQ of Slimbox2
// AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
jQuery(function($) {
$("a[rel^=’lightbox’]").slimbox({/* Put custom options here */}, function(el) {
return [el.href, el.title + ‘<br /><a href="’ + el.href + ‘">Download this image</a>’];
}, function(el) {
return (this == el) || ((this.rel.length > ” title=”Cool” /> && (this.rel == el.rel));
});
});I added in "slimbox2_autoload.js" Got it working for a while but it stopped all the sudden.. Maybe there was an Update?
July 10, 2011 at 3:43 pm #9336malcalevakModeratorIt actually sounds like you’re not using the WordPress plugin, but running Slimbox by itself.
Are you running WordPress?
Can you provide a link to your website?July 10, 2011 at 3:46 pm #9337AnonymousMemberI am using WP-Slimbox2
http://www.wearepixelated.com click on Pictures and select an album:
It kinda worked now. But now the CSS Settings are ignored (i changed my overlay to blue. But as you can see. It’s black)
July 10, 2011 at 4:39 pm #9338malcalevakModeratorI see a blue overlay…perhaps you have some sort of caching issue?
From what I can see, everything looks fine, though it appears you’ve made some of the background colors around the image black.July 10, 2011 at 4:45 pm #9339AnonymousMemberSorry i already changed it. I’m now back from scratch. The code i got from the FAQ isn’t working. The reason why i mentioned that i KINDA worked in my prev. Post is that for some reason the autoload.js was a little different from the original…
So i downloaded a new copy and started over again… Now it works but the Download code from FAQ isn’t..
Is there an alternative or am i doing someting wrong.. Here is what i did:
added:
// AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
jQuery(function($) {
$("a[rel^=’lightbox’]").slimbox({/* Put custom options here */}, function(el) {
return [el.href, el.title + ‘<a href="wp-content/downloadpicture.php?filename=’ + el.href + ‘" target="_blank"><img src="http://wearepixelated.com/images/download.jpg" border="0"></a>’];
}, function(el) {
return (this == el) || ((this.rel.length > ” title=”Cool” /> && (this.rel == el.rel));
});
});to: wp-slimbox2/javascript/slimbox2_autoload.js
This adds nothing at all… This should add my download link…
Any thoughts?
July 10, 2011 at 5:24 pm #9340malcalevakModeratorWhat is this FAQ you’re referring to? That bit of code isn’t tied to the plugin (just the original Slimbox). To add the download link all you need to do is check the box in the settings panel.
July 10, 2011 at 5:29 pm #9341AnonymousMemberThe FAQ of slimbox: http://code.google.com/p/slimbox/wiki/FAQ
I know this plugin has that feature. But your downloading option is based on Captions or 4 other ref’s.
I made my own download link which i used with Lightbox. That if you click the link you get the picture Directly downloaded to your computer.
So i need to modify where the link is going to. And i want the text "download this image" in the caption…
How do i do this with your plugin??
– Need to modify the Caption link.
– With one link text like "download this image" for all images…My this where i need my links to go to:
wp-content/downloadpicture.php?filename=’ + el.href + ‘thanks
July 10, 2011 at 5:52 pm #9342malcalevakModeratorJust to make sure I’m understanding you correctly, you don’t want the download link to be like:
http://www.wearepixelated.com/wp-conten … g_6061.jpgYou actually want it to run through that downloadpicture.php deal?
July 10, 2011 at 5:55 pm #9343AnonymousMemberThat’s correct! And the text link needs to be the same. you think you can help me out?
July 10, 2011 at 6:13 pm #9345malcalevakModeratorWell, getting the text link is easy, you’d just put that as the alt-text. The trouble is more tied to your downloadpicture.php, what exactly is it doing?
The next release does allow you to put custom URLs in with the captions, however you’d need to put that in the alt-text as well.
If you insist on changing the javascript, you likely should move to the next release (which I can post here for you), as the changes you’d need to make are drastically different between versions.
July 10, 2011 at 6:19 pm #9346AnonymousMemberText link… does that mean i have to copy’n’paste the text i want over and over again for each image?
Yes custom URLs would be very usefull! I think i’ll take my chance and try to change the JS if you’re willing to post the Next Release for me…
But just an side thought.. Isn’t there any way to make that code i got from the FAQ work with your Plugin?? Would save a lot of work i think.. or i just could be wrong.
Thanks.
July 10, 2011 at 7:04 pm #9347malcalevakModeratorWell, it all really comes down to what features of the plugin you actually want to use vs the changes you want to make.
Change:
[code:2ju594ca]
if (el.href.match(/^http://picasaweb.google./)!=null) {
var href = el.firstChild.src.replace(//sd+(?:-c)?/([^/]+)$/, "/s640/$2");
} else if (el.href.match(/^http://www.flickr.com/photos//)!=null) {
var href = el.firstChild.src.replace(/_[mts].(w+)$/, ".$1");
} else var href = el.href;
return parseForURL(href,eval(slimbox2_options[’caption’]));
[/code:2ju594ca]to your changed code (this will remove picasa and flickr support).
July 10, 2011 at 8:10 pm #9348AnonymousMemberthanks alot! im going to work on this now… I will keep you updated!
July 10, 2011 at 8:29 pm #9349AnonymousMemberi got it working! You never guess how ” title=”Tongue” />
I added that FAQ code right above the code you told me to change… so in a way i didn’t changed anything… only added something!
take a look now http://wearepixelated.com/?page_id=101
if you like this way of downloading images off slimbox, i could send you the php file i created…
Thank you so much for your help!
July 10, 2011 at 10:50 pm #9350malcalevakModeratorI’m glad you were able to get it working, but placing the code there actually alters several things for people who don’t choose to run with autoload on, but in your case it should do fine.
I’m curious as to what exactly that php file is doing as it’s still quite easy to download images the way it is.
Anyway, glad I could help.
-
AuthorPosts
- You must be logged in to reply to this topic.