Hi,

On my production sites, I noticed that the galley selection list disappeared in the Image contents. The galleries are still there if I go to Image galleries in the admin section, but when I try to create a new image content or edit an existing one, the gallery selection list are not there anymore.

On my test site, I managed to fix this problem by uninstalling the Image module completely, disabling and re-enabling it won't do.

However, I'm looking for a way to solve this issue without uninstalling the module, because I will lose all the existing images and galleries.

Thanks in advance.

Comments

valel46’s picture

By the way, I found out that the existing images will stay, but all the existing galleries will be gone once I uninstall the Image module.

shelleyp’s picture

When the module was updated, the Gallery taxonomy item is no longer associated with a content type. You have to manually reset the Image Galleries taxonomy to apply to the image content type.

joachim’s picture

Did you disable the module when you upgraded?

i thought we'd fixed this :(

joachim’s picture

Hmm problem with our fix, I think:

  if (empty($vid) || !($vocabulary = taxonomy_vocabulary_load($vid))) {
    // Check to see if an image gallery vocabulary exists.
    $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = 'image_gallery'"));
    if (!$vid && !$vocabulary) {
      $vocabulary = array(
        'name' => t('Image Galleries'),
        'multiple' => 0,
        'required' => 0,
        'hierarchy' => 1,
        'relations' => 0,
        'module' => 'image_gallery',
        'nodes' => array('image' => 1),
      );
      taxonomy_save_vocabulary($vocabulary);
      $vid = $vocabulary['vid'];
    }
    elseif ($vocabulary) {
      // Existing install; ensure that image node type is still assigned.
      // Keep all other node types intact there.
      $vocabulary = (array) $vocabulary;
      $vocabulary['nodes']['image'] = 1;
      taxonomy_save_vocabulary($vocabulary);
      $vid = $vocabulary['vid'];
    }
    variable_set('image_gallery_nav_vocabulary', $vid);
  }

As far as I can tell we'll never get to the elseif:
if (empty($vid) || !($vocabulary = taxonomy_vocabulary_load($vid))) {

if the vid is empty, then the first part satisfies, so the other half of the || doesn't happen.
Is my reading of the code correct?

I'm also not sure why we're doing both a taxonomy_vocabulary_load and our own query?

valel46’s picture

Priority: Normal » Critical

shelleyp's suggestion did the trick, thanks a lot.

joachim, no, but is disabling required for upgrading the Image module? I read that many modules don't need to unless from a major version upgrade.

valel46’s picture

Priority: Critical » Normal
joachim’s picture

Priority: Critical » Normal

@valel46: disabling is what caused the problem with previous versions.

Could someone try disabling then enabling image gallery to see if this causes the problem?

valel46’s picture

joachim,

I just tested it on my test box with 6.x-1.0-alpha5, just by disabling and then re-enabling it will clear the taxonomy associated item.

joachim’s picture

Could you try the dev release too please?

I've just checked the dates -- alpha-5 was released before we committed the fix for this: #470720: Disabling then reenabling image module makes the gallery vocab forget about images.

valel46’s picture

Still want me to try the dev release?

By the way, I've never tried installing any dev releases before, what does "WATCH OUT THERE IS NO UPGRADE PATH AT THIS POINT" mean in the release note?

joachim’s picture

No, panic over :)
I think we ran that patch through its paces.

I think we should perhaps remove that warning -- it must date from very early D6 work.

joachim’s picture

Status: Active » Closed (duplicate)

Closing as duplicate, as already fixed elsewhere.

suffering drupal’s picture

I have the same problem.
Image galleries appears in taxonomy list and under "edit vocabulary" it IS associated with the "Image" content type. Several terms are defined.
They do show up when creating a new image (using Fupload). However they do not show up when editing an image. With the old version it was working fine.
Also an essential additional piece of script which generates a <<

>> does not work anymore (¿¿how is it possible "next-previos" is not a core element of image??? - http://drupal.org/node/61704#comment-875223) @ shelleyp What do you mean by "reset"? Delete the Vocabulary and start again? This is actually what I did after upgrading.... I'll just going back to the old version. Somehow new versions always seem to solve some existing problems, but introduce other new problems you didn't know of...
joachim’s picture

@suffering drupal

> ¿¿how is it possible "next-previos" is not a core element of image
Because that can be done with custom pagers.
As said on #61704: setting up Custom Pagers to allow browsing next/previous image in gallery, I will welcome any documentation on how to set this up.

Deleting the vocab and starting again will likely kill the association set in image_gallery. You should check the value of that variable.

In general: if you rollback to an old version, then a) I can't support you, and b) you're removing yourself from the efforts to continue to improve this module.

suffering drupal’s picture

@ joachim
You make it sound very easy as all you hard-core drupalers always do.
Does it mean you think "patching" (never worked for me) or putting code in php is kind of user-friendly???
Why do you think I changed my name to "Suffering Drupal"? Actually the full name should be "Eternal newbie suffering Drupal" but its to long and it doesn't show.
I think basic philosphy of Drupal is great. But it is impossible to make any advance without some rather extended basic know-how. I have been trying since over 2 years only based on Trial & Error and I still feel newbie. There are hardly any good explanations for newbies and there is too much understanding taken for granted from the developers or maintainers. Too many times I see "won't fix" or "need more info". Well I (and I suppose most fellow-newbies) need more info too, nearly always.

For example you say "will likely kill the association set in image_gallery. You should check the value of that variable."
What IS "image_gallery", why don't you mention exactly WHERE that variable can be found? Do you mean the "image gallery" module (admin/build/modules/list - don't see any option) or "image gallery" from content management (admin/content/image/list - don't see any option) or do you mean get in some xxx.php file? Which one, in what directory?? Or is it the image.module?
See what I mean?

I have lost exactly 24 hours just because I decided to give the new image version a try, in other occasions I have lost weeks.... I would definitely like to help in development, but I just can't loose so much time and I actually have an ever growing FEAR to try anything new once something is slightly working - maybe Image just made me decide to NEVER try any update again. I am afraid I feel forced to accept a 70 or even 60% coverage of my objectives for all I try to do in Drupal and have grown to simply prefer something working half today, than getting stuck for weeks.

Anyway, concerning the "previous - next" option for the Image module; the code that works from http://drupal.org/node/61704#comment-875223 (in the old version of Image) is as follows:

SUBSTITUTE:

function theme_image_body($node, $size) {
return image_display($node, $size);
}

BY:

function theme_image_body($node, $size) {
return ph_image_navigation($node) . image_display($node, $size);
}

function ph_image_navigation(&$node) {
global $base_url;
$previous=0;
$next=0;
$tmp_prev=-1;
$output="
";
$terms = taxonomy_node_get_terms_by_vocabulary($node, _image_gallery_get_vid());
if ($terms) {
$term = array_pop($terms);
$res = db_query("SELECT n.nid FROM {term_node} t, {node} n WHERE t.tid=$term->tid AND n.nid=t.nid ORDER BY n.title ASC");
while ($nidvalue=db_result($res)){
if($previous!=0 && $next==0) {
$next=$nidvalue;
}
if($nidvalue == intval($node->nid)) {
$previous=$tmp_prev;
}
$tmp_prev=$nidvalue;
}

IN image.module under /public_html/sites/all/modules/image

Is it really such a problem to include these about 20 lines of code directly in the module instead of having people searching in google, maybe for hours, until they find http://drupal.org/node/61704#comment-875223 and then have to ftp, copy and paste the code and hope that it works?

joachim’s picture

First, I'm very flattered to be called a hardcore Drupaller :D
Believe me, I began as a total newbie. It wasn't that long ago that I found CVS and patching to be horribly arcane and confusing things. Thankfully, documentation is good, and people on IRC are ready to help.

I tend to respond to issues without a copy of the code to hand, and perhaps I should, so I can give more definite answers.
There is a variable image_gallery_nav_vocabulary. You don't set it in the UI, it's meant to work automatically. If you recreated your vocab, then it's been screwed. You will need devel module to change it yourself.

As for development time -- this is something that has to be factored into costs, in my opinion. This was actually discussed at drupal drinks last night: either clients get something cheap, out of the box, or they want development and customization, which is a big step up in terms of cost.

Also: always always test updates on a development copy!

As for pagers -- see my comments on that issue. I won't be including that code because the correct way to do this is with the custom pagers module.

suffering drupal’s picture

Yo Joachim,

you know what? I haven't even been capable of setting up a test environment, so your always always, I have never never done... I should try to find a moment for it, but since Drupal it seems all my time just disappears in trying to achieve even the most simple things.. For the moment I'll stick with the less correct, but working and for me understandable option.

joachim’s picture

That's your choice, but the time spent in setting up a test server will be gained in hair-tearing when you try new code on your live server.

steveiebadmin’s picture

I also had the same problem - all of our Drupal 6.xx sites are missing their images today. We upgraded to 6.x-1.0-alpha5 from 6.x-1.0-alpha4 and the problem is still not corrected...

joachim’s picture

Missing images, or missing gallery selection dropdown? If the former, you're in the wrong issue. Please search the queue for duplicates and file a new one if you don't find anything.