Problems doing a custom block in drupal - I've tried three methods, but can't get any to work

njehlen

Joined: 2006-04-25
Posts: 5
Posted: Wed, 2006-04-26 21:51

I'm trying to integrate Gallery 2.1 into my Drupal 4.6.6 installation. I've had good luck so far - the Gallery Block works great and I can access the embedded gallery just fine. I have all the URL rewrite rules turned off except "Show Item."

But, when I try to do a custom block that grabs a Gallery image, things really go haywire. I've seen three different methods suggested to do this - I've tried each one, the results are below.

I need to have a lot of control over the output of these blocks, which is why I can't use the block built into the Drupal gallery.module.

Possible problem: I've seen in several posts that I should turn on the two blocks that the gallery.module creates. But when I turn on the gallery.module, it only creates one block for me: Gallery Block. What is the other one? Anyone ever run into this?

Ok - here are the 3 methods with corresponding errors

method 1: G2 filter
I've created a block with this code:
[G2:18 n=1 type=randomImage size=250 class=right frame=name album_frame=dots]

But with the g2 input format filter turned on, nothing shows up - not even the block title. When i switch to another filter, the title and the text above shows up. I've checked and 18 is an ID of one of my photos.

--------------------
method 2: php readfile
using this code:
<?php @readfile('http://www.website.com/gallery2/main.php g2_view=imageblock.External&g2_blocks=randomImage&g2_show=fullSize|title&g2_maxSize=260&g2_itemFrame=wood'); ?>

I get this error:
warning: readfile(http://www.website.com/gallery2/main.php g2_view=imageblock.External&g2_blocks=randomImage&g2_show=fullSize|title&g2_maxSize=260&g2_itemFrame=wood): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
in /usr/www/users/username/websiteroute/includes/common.inc(1816) : eval()'d code on line 1.

--------------------
method 3: GalleryEmbed::getImageBlock()
using the code from this page: http://codex.gallery2.org/index.php/Gallery2:GalleryEmbed:getImageBlock

(my gallery2 folder is called gallery2, and its on the same website as my drupal installation)

I get these errors:
warning: Unknown(/usr/www/users/username/websiteroute/includes/gallery2/embed.php): failed to open stream: No such file or directory in /usr/www/users/username/websiteroute/includes/common.inc(1816) : eval()'d code on line 3.

Fatal error: (null)(): Failed opening required '/usr/www/users/username/websiteroute/includes/gallery2/embed.php' (include_path='.:/usr/local/lib/php') in /usr/www/users/username/websiteroute/includes/common.inc(1816) : eval()'d code on line 3

The trouble (maybe?) is that its looking in the includes folder for my gallery2 installation - but I can't seem to figure out how to change where its looking.