[ PHALKUNZ'S BLOG ]

I've moved to http://phalkunz.com. You'll be redirect to my new blog soon.

Monday, May 21, 2007

Download/Save Unsavable Flickr Photos

Has it ever happened to you when you tried to save a flickr photo but you ended up saving another blank image file called "spaceball.gif" instead? I don't exactly know what flickr is trying to do. Preventing people from downloading those photos? Maybe. What flickr does is it uses another transparent image to overlay the main image to block users from downloading the actual image. Is there a way to get around it? Yeah of course. It's no wonder that if you can download youtube videos, you must be able to save protected flickr photos somehow. There are a few ways you can do this. One approach is to screenshot and then use image editing application to crop the part that you want but believe me it's such a pain in the arse. Another one is to actually read the code and extract the real image url and the paste it to browser address bar but i'm sure you don't wanna do this. Ok enough of all that hassle. I've written a few lines of javascript code that can be plugged into Greasemokey to display an actual link to the image. The code is written as follows:


// ==UserScript==
// @name SaveFlickrImg
// @namespace http://phalkunz.blogspot.com
// @description Displays a download link for an unsavable flickr photo
// @include http://www.flickr.*/*
//
// ==/UserScript==

var imgsrc;
var img;
var imgParent;
var flag = false;

var imgs = document.images;
for (var i=0; i<imgs.length; i++) {
var src = imgs[i].getAttribute("class");
if (src=="reflect"){
img = imgs[i];
imgParent = img.parentNode;
imgsrc=imgs[i].getAttribute("src");
flag = true;
}
}

if (flag) {
var my_banner = document.createElement("div");
my_banner.innerHTML = '<div style="border-bottom: 1px solid #333333; margin-bottom: 10px; font-size: small; background-color: #336699; color: #FFFFFF;>' +
'<p style="margin:0px;padding: 5px;">' +
' <a href="' + imgsrc + '" style="color:#FFFFFF; font-weight:bold; font-size:10px;">main image link</a>' +
'</p></div>';
imgParent.appendChild(my_banner);
}



Save that code as, for example, saveFlickrPhoto.user.js and install that file in greasemonkey. That's it. Go to that flickr photo that you couldn't download but this time it will show a link under the photo. That's it. I'm sure you know how to do it from there.

7 comments:

Vibolka said...

Great job! I'm using firefox browser so when I want to save an image I just right click on the picture and copy the the image location and then paste it in the address bar.
I used to spent some time searching on the internet whether there is any way to know who is the uploader of a photo from Flickr. I meant a Flickr's user who uploaded the image , but I couldn't find any way to do that. If you can, please don't forget to share me phorngggg.

p+k said...

I don't really get your question. if you can copy the link of an image from the image location why don't your just use "Save Image As" instead of pasting the image location into the browser address bar.

And you also you wanna know who is the owner of a photo hosted on flickr? Is that another question? If so, I don't think i can do it because image url doesn't contain any information about the owner of the photo.

Vibolka said...

Yes, that's what i wanted to know. It is of course impossible.

Unknown said...

how do you install it into greasemonkey?

thanks

p+k said...

In order to install it you need to save the script with a filename in the form of the one shown above, it has to has .user.js part. And then you drag the saved script file icon and drop it on firefox (page area) and there will be a instruction showing you what to do from there.

DiscGoIsUm said...

Cheers, was looking for a script like this, tired of finding the right url in the html. Awesome.

Anonymous said...

cool script. here's another way to do it.

 How To Steal Photos on Flickr