Not sure if this is the right place to post but below is a snippet to resize any of the flickr photos using one of your imagecache presets. Just in case some one wants to know how to do it.
At the moment I am hacking the core module and would appreciate it if anyone can suggest a better way of doing it. Also I think this only work when you are using the cck field but I'm sure can be adapted for other uses.
In flickr.inc line 200 in the flickr_img function I edit out the theme_image part as I don't want to output a regular image. Then I put the following code below:
<?php
$path = 'sites/default/files/flickr/' . $photo['id'] . '.jpg'; //set where you want to download the original file.
if(!file_exists($path)) {
$img = imagecreatefromjpeg($img_url);
imagejpeg($img, $path, 90); //save the image to the location
imagedestroy($img);
$attributes['height'] = '280'; //set the attributes if you want
$attributes['width'] = '540';
$preset = 'doverview_main'; //change the imagecache profile
}
return theme('imagecache', $preset, $path, $title, $title, $attributes);
?>
Is there a better way of achieving this?
Comments
Comment #1
atolborg commentedI havent tried this, because I dont feel "comfortable" hacking the module. However, the idea behind the functionality is great. Ofc flickr module should be able to use imagecache.
Comment #2
lolandese commentedMarked #325599: download a copy of the image as a dup of this one.
Comment #3
lolandese commentedMarked #325599: download a copy of the image as a dup of this one.
From that issue (edited):
See http://www.mousewheel.net/ciao-michele-english for more info on copyright of digital images.
Conclusion: as long you do not put an image on your own server (download it), there is typically no infringing "copy" on which to base liability. Using the original source of an image that is hosted elsewhere (as the current version of the Flickr module does) respects the copyright.
If this functionality is ever to be implemented, it would be wise to allow it only for the default Flickr user ID as set on the Flickr settings page, presuming the website owner is the same person as the Flickr account holder and adding a clear warning about it.
Extending for other users could lead to the risk of unknowingly downloading images that are copyright protected, without website users or owners even being aware of it. They could simply 'blame' the functionality of the module.
An interesting legal topic. Patches that take that in consideration are welcome.
Thanks.
Comment #4
kabarca commentedYou can import Flickr images to your server as long as they have the correct Creative Commons licence. Here's the explanation: http://www.flickr.com/creativecommons/
You can even get the CC information from the API so you know which images are good to be imported: http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html
Comment #5
lolandese commentedIt is definitely right to mention the existence of CC here which makes for a good use case for the requested functionality. Nevertheless the fact of 'unknowingly' downloading images with copyright should be sufficiently taken care of by anyone supplying a patch or an extending module. The latter would be preferred as the functionality itself is out of the scope of this module (see documentation).
We might include license info optionally in the caption as is done with the date, location and Flick username in the latest dev.
EDIT: See #2176433: Add optionally license info.
Thanks.
Comment #6
lolandese commentedSee #2367755: D6 maintenance.