I want all images uploaded by a user stored in a personal gallery.

Since i didn't find a suitable solution, i added a gallery for every user (username = gallery name) and changed the taxonomy module:

function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') {
  $vocabulary = taxonomy_get_vocabulary($vid);
  $help = ($help) ? $help : $vocabulary->help;
  if ($vocabulary->required) {
    $blank = 0;
  }
  else {
    $blank = '<'. t('none') .'>';
  }
 
  //custom
  global $user;
  if ($user->uid!=1 && $vid==3) {                           //3 = image gallery Vocabulary ID(vid)
    $res = db_query('SELECT * FROM {term_data} WHERE name = "%s"', $user->name);
    $term_data = db_fetch_object($res);
           
    return array('#type' => 'select',
      '#title' => $title,
      '#default_value' => $value,
      '#options' => array($term_data->tid => $user->name),
      '#description' => $description,
      '#multiple' => $multiple,
      '#size' => $multiple ? min(9, count($options)) : 0,
      '#weight' => -15,
      '#theme' => 'taxonomy_term_select',
            );
  }
  //custom
 
  return _taxonomy_term_select(check_plain($vocabulary->name), $name, $value, $vid, $help, intval($vocabulary->multiple), $blank);
}

This causes only the gallery with the same name as current user is beeing showed to all users except admin for image upload.

Then i added a profile field where i entered a link to the gallery, so every user got his own gallery ;-)

Just wanted to know whether there is a better solution, which doesn't make things more complicated for my users.

Comments

picturebook’s picture

I think your hack may have saved my rear. Can you explain some more about "Then i added a profile field where i..."? I am lost about accessing this from the user side as well as admin.

fluitfries’s picture

it's still really hard for me to beleive that this type of feature hasn't been offered up by a module yet. considering the popularity of myspace and all the copycats, it has to be a big desire for drupal admins...

still looking...

dmjossel’s picture

The image.module, when galleries were supported in it (instead of as a separate contrib module) used to support individual galleries for every user, with size and image quotas.

Sometime after 4.4 or possibly 4.5 this feature was removed.

anrahman’s picture

This sounds like a really neat idea. How exactly would you go about implementing this code?

--
Aniq

sepeck’s picture

http://www.lullabot.com/articles/how_to_build_flickr_in_drupal as an alternative

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

cgallo’s picture

i will try this. thanks for the info.

Gerard McGarry’s picture

This has literally been driving me nuts. Thanks for the link, hopefully it solves my per-user gallery problem!

cgallo’s picture

will this work with drupal 5.7???

eugene20237’s picture

Hi! I have been created modified version of image_gallery. It can be possible create many galleries per each user. You can download this here: https://dl.getdropbox.com/u/493679/image_gallery_per_user.zip
P.S.: sorry, english is not my native language.