Would be nice to add an option to store images on flickr only.

Comments

Denys Babenko’s picture

I wonder if it is possible to add the feature or perhaps integrate Flickr module and Flickr ImageField so that:
a) Image upload looks to the user as if it was normal image field
b) The actual image store is flickr, e.g. images are not stored on the website

sirkitree’s picture

I'm already storing the Flickr ID (though it should probably be in its own table instead of modifying the files table) and that is basically all you need (maybe a size parameter as well) in order to run something through a flickr theme function to display it. Then it's as simple as a checkbox to determine if you display the regular file or the flickr one.

I'm unsure though if you can run that through imagecache then though, which some people may end up wanting in order to control the image's size.

Might still have to keep the image locally as well, but I'm not sure if filefield or imagefield or something else has a cron process that cleans out non-existent file entries from the files table.

Denys Babenko’s picture

Thanks for quick response. I'm going to check if it's possible to adapt filefield for "remote files".
But the more I think of it the more it seems a weird idea :) Do you think people may need it?
I mean duplicating images on flickr is great, but set up flickr images for drupal imagefield... :)

sirkitree’s picture

I think it has a certain relevancy when it comes to server load. Better to pull an image off of Flickr and use their bandwidth rather than server it up from your own.

Denys Babenko’s picture

Right :) Cheap hosting on one of my projects, that's why I started thinking of how I could use flickr

lupus78’s picture

hey,

here's a piece of code, that adds formaters for flickr_imagefiled module
It is quite basic, as it has only one option (Image form Flickr), and no size option currently. The size is hardcode, in the code (see comment).

grab this piece of code, and insert it into the end of the flickr_imagefield.module file. disable and reenable the module, clear cache, and you will find the option under the field display settings.

/**
 * Implementation of hook_theme().
 */
function flickr_imagefield_theme() {
  return array(

    'flickr_imagefield_formatter_flickr' => array(
      'arguments' => array('element' => NULL),
    ),
  );
}

/**
 * Implementation of CCK's hook_field_formatter_info().
 *
 * Returns information about available field formatters.
 */
function flickr_imagefield_field_formatter_info() {
  return array(
    'flickr' => array(
      'label' => t('Image from Flickr'),
      'field types' => array('image', 'filefield'),
			'multiple values' => CONTENT_HANDLE_CORE,
    )
  );
}

/**
 * Theme function for default formatter.
 */
function theme_flickr_imagefield_formatter_flickr($element = NULL) {

  if($element['#item']['flickr_imagefield_location'] == NULL) {
    return '';
  }
	// Changed to your desired size
	$size = "-";
	$photo = flickr_photo_get_info($element['#item']['flickr_imagefield_location']);
	$img = theme('flickr_photo', $photo, $size );
	return $img;
}

don't forget to change the size:

	// Changed to your desired size
	$size = "-";

Would be nice to render all size options, but i have no time to do it currently.

Please feedback if you find it useful.

Lupus