Hi,
I've been using Gallery module v.1.0 for quite a while. The set up was:

Gallery module 1.0
Gallery2 v.2.1.2
Drupal 5.2
URL Rewrite switched off (my setup with version 1.0 and G2Image plugin for TinyMCE didn't like it...)

Then I've upgraded it to Gallery module 2.0 and Gallery2 2.2.3. Everything went smooth except one issue: my Image Block (located on the right sidebar) shows no image in 4 out of 5 times I reload the page:

<div id="sidebar-right" class="sidebar">
    <div id="block-gallery-image-0" class="clear-block block block-gallery">
      <h2>Gallery</h2>
      <div class="content">
          <div class="g2image_centered">
               <div class="one-image">
                     <a href="http://localhost/nihonto/index.php?q=gallery&amp;g2_itemId=21">
                     </a> 
               </div>
          </div>
       </div>
  </div>
...

And then eventually the proper thumbnail appears:

<div id="sidebar-right" class="sidebar">
  <div id="block-gallery-image-0" class="clear-block block block-gallery">
    <h2>Gallery</h2>
    <div class="content">
      <div class="g2image_centered">
        <div class="one-image">
           <a href="http://localhost/nihonto/index.php?q=gallery&amp;g2_itemId=43">
                  <img src="http://localhost/nihonto/gallery2/main.php?g2_view=core.DownloadItem&amp;g2_itemId=44&amp;g2_serialNumber=2&amp;g2_GALLERYSID=3c4f74fadb9ad863ce5651b0bea8577f" width="150" height="113" id="IFid1" class="ImageFrame_none" alt="DSCN5493"/>
           </a> 
        </div>
      </div>
     </div>
    </div>
...

Drupal logs, web server logs show no errors. Problem exists both in test Windows-based environment and Linux server.

I've tried dropping Gallery2 and Drupal caches, resetting the configuration of Image Block plugin, Gallery module etc. The situation didn't improve.

Kind Regards,
Stan

Comments

kazarena’s picture

Hi again,

I've been doing some research on that issue. Here's what I've found.

1. Gallery module makes a correct request to Gallery 2 API and Gallery 2 returns correct HTML for the Image Block content (with IMG tag inside).
2. For some reason this IMG tag gets removed by Drupal themeing (I couldn't figure out where exactly it happens).
3. When trying to troubleshoot this issue I've changed the theme back to Garland (my 'normal' theme is a clone of Garland with some additions). Garland seemed to show images in the Image Block much more frequently, and there was some pattern in it: it only showed images without longdesc attribute for IMG tag which Gallery 2 populates with image description text. E.g.

<img src="http://example.com/gallery/d/31-2/.jpg" width="150" height="150" id="IFid1" class="ImageFrame_image" alt="Gallery" longdesc="This is the main page of your Gallery"/>

4. According to HTML spec the value of longdesc attribute must be a URL, not text. I googled this issue and Gallery forums had a solution how to remove longdesc (See http://gallery.menalto.com/node/49284). I tried it and it cured Garland theme.
5. For some reason my main theme still had that issue. After few hours of digging into Gallery & module code some combination of theme/gallery setup/block setup (no code changes made except debug output) solved the issue with my main theme as well.

I'm not a PHP programmer myself (Java is my turf) so I might have missed something obvious. I still don't know the exact reason for IMG tag to dissappear, but the 'longdesc' fix seemed to have an immediate effect at least for Garland. It's not clear to me why it would make a difference. I hope it does for you :-)

Regards,
Stan