Gallery2 drupal integration

OK, so many folks have issues with gallery2 / drupal5 integration. My symptom was 404s on images and white screens on many pages. Some will recommend turning off gallery's clean urls implementation. That is a fine solution if it works for you. It didn't work well for me. So here's what I figured out after scouring everywhere for error messages.

An answer that works without turning off clean urls is to make sure that your gallery url is properly set under "Show Item " on this gallery config page:

http://yoursite.com/index.php?q=gallery&g2_view=core.SiteAdmin&g2_subView=rewrite.AdminRewrite

for instance, my gallery installation "embed URI" (find it under the gallery2 drupal settings screen >> install tab >> step2 fieldset, is
/index.php?q=gallery

so my "Show Item" rewrite rule should be:
gallery/v/%path%

The /v/%path% part is in there already, so just add whatver you have after the q= from the page above.

There is even an almost invisible warning to do this that shows up on the gallery2 integration module install page :), but alas, it's almost invisible. No idea why it isn't done for you on install!